github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/cce/v3/addons/results.go (about)

     1  package addons
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  )
     6  
     7  type Addon struct {
     8  	// API type, fixed value Addon
     9  	Kind string `json:"kind" required:"true"`
    10  	// API version, fixed value v3
    11  	ApiVersion string `json:"apiVersion" required:"true"`
    12  	// Metadata of an Addon
    13  	Metadata MetaData `json:"metadata" required:"true"`
    14  	// Specifications of an Addon
    15  	Spec Spec `json:"spec" required:"true"`
    16  	// Status of an Addon
    17  	Status Status `json:"status"`
    18  }
    19  
    20  // Metadata required to create an addon
    21  type MetaData struct {
    22  	// Addon unique name
    23  	Name string `json:"name"`
    24  	// Addon unique Id
    25  	Id string `json:"uid"`
    26  	// Addon tag, key/value pair format
    27  	Labels map[string]string `json:"lables"`
    28  	// Addon annotation, key/value pair format
    29  	Annotations map[string]string `json:"annotaions"`
    30  }
    31  
    32  // Specifications to create an addon
    33  type Spec struct {
    34  	// For the addon version.
    35  	Version string `json:"version" required:"true"`
    36  	// Cluster ID.
    37  	ClusterID string `json:"clusterID" required:"true"`
    38  	// Addon Template Name.
    39  	AddonTemplateName string `json:"addonTemplateName" required:"true"`
    40  	// Addon Template Type.
    41  	AddonTemplateType string `json:"addonTemplateType" required:"true"`
    42  	// Addon Template Labels.
    43  	AddonTemplateLables []string `json:"addonTemplateLables,omitempty"`
    44  	// Addon Description.
    45  	Description string `json:"description" required:"true"`
    46  	// Addon Parameters
    47  	Values Values `json:"values" required:"true"`
    48  }
    49  
    50  type Status struct {
    51  	// The state of the addon
    52  	Status string `json:"status"`
    53  	// Reasons for the addon to become current
    54  	Reason string `json:"reason"`
    55  	// Error Message
    56  	Message string `json:"message"`
    57  	// The target versions of the addon
    58  	TargetVersions []string `json:"targetVersions"`
    59  }
    60  
    61  type commonResult struct {
    62  	golangsdk.Result
    63  }
    64  
    65  // Extract is a function that accepts a result and extracts an Addon.
    66  func (r commonResult) Extract() (*Addon, error) {
    67  	var s Addon
    68  	err := r.ExtractInto(&s)
    69  	return &s, err
    70  }
    71  
    72  // CreateResult represents the result of a create operation. Call its Extract
    73  // method to interpret it as an Addon.
    74  type CreateResult struct {
    75  	commonResult
    76  }
    77  
    78  // GetResult represents the result of a get operation. Call its Extract
    79  // method to interpret it as an Addon.
    80  type GetResult struct {
    81  	commonResult
    82  }
    83  
    84  // UpdateResult represents the result of an update operation. Call its Extract
    85  // method to interpret it as an Addon.
    86  type UpdateResult struct {
    87  	commonResult
    88  }
    89  
    90  // DeleteResult represents the result of a delete operation. Call its ExtractErr
    91  // method to determine if the request succeeded or failed.
    92  type DeleteResult struct {
    93  	golangsdk.ErrResult
    94  }
    95  
    96  type ListTemplateResult struct {
    97  	golangsdk.Result
    98  }
    99  
   100  type ListInstanceResult struct {
   101  	golangsdk.Result
   102  }
   103  
   104  type SupportVersion struct {
   105  	// Cluster type that supports the add-on template
   106  	ClusterType string `json:"clusterType"`
   107  	// Cluster versions that support the add-on template,
   108  	// the parameter value is a regular expression
   109  	ClusterVersion []string `json:"clusterVersion"`
   110  }
   111  
   112  type Version struct {
   113  	// Add-on version
   114  	Version string `json:"version"`
   115  	// Add-on installation parameters
   116  	Input map[string]interface{} `json:"input"`
   117  	// Whether the add-on version is a stable release
   118  	Stable bool `json:"stable"`
   119  	// Cluster versions that support the add-on template
   120  	SupportVersions []SupportVersion `json:"supportVersions"`
   121  	// Creation time of the add-on instance
   122  	CreationTimestamp string `json:"creationTimestamp"`
   123  	// Time when the add-on instance was updated
   124  	UpdateTimestamp string `json:"updateTimestamp"`
   125  }
   126  
   127  type AddonSpec struct {
   128  	// Template type (helm or static).
   129  	Type string `json:"type" required:"true"`
   130  	// Whether the add-on is installed by default
   131  	Require bool `json:"require" required:"true"`
   132  	// Group to which the template belongs
   133  	Labels []string `json:"labels" required:"true"`
   134  	// URL of the logo image
   135  	LogoURL string `json:"logoURL" required:"true"`
   136  	// URL of the readme file
   137  	ReadmeURL string `json:"readmeURL" required:"true"`
   138  	// Template description
   139  	Description string `json:"description" required:"true"`
   140  	// Template version details
   141  	Versions []Version `json:"versions" required:"true"`
   142  }
   143  
   144  type AddonTemplate struct {
   145  	// API type, fixed value Addon
   146  	Kind string `json:"kind" required:"true"`
   147  	// API version, fixed value v3
   148  	ApiVersion string `json:"apiVersion" required:"true"`
   149  	// Metadata of an Addon
   150  	Metadata MetaData `json:"metadata" required:"true"`
   151  	// Specifications of an Addon
   152  	Spec AddonSpec `json:"spec" required:"true"`
   153  }
   154  
   155  type AddonTemplateList struct {
   156  	// API type, fixed value Addon
   157  	Kind string `json:"kind" required:"true"`
   158  	// API version, fixed value v3
   159  	ApiVersion string `json:"apiVersion" required:"true"`
   160  	// Add-on template list
   161  	Items []AddonTemplate `json:"items" required:"true"`
   162  }
   163  
   164  // Extract is a function that accepts a result and extracts an Addon.
   165  func (r ListTemplateResult) Extract() (*AddonTemplateList, error) {
   166  	var s AddonTemplateList
   167  	err := r.ExtractInto(&s)
   168  	return &s, err
   169  }
   170  
   171  type InstanceMetadata struct {
   172  	ID                string            `json:"uid"`
   173  	Name              string            `json:"name"`
   174  	Labels            map[string]string `json:"labels"`
   175  	Annotations       map[string]string `json:"annotations"`
   176  	UpdateTimestamp   string            `json:"updateTimestamp"`
   177  	CreationTimestamp string            `json:"creationTimestamp"`
   178  }
   179  
   180  type AddonInstanceSpec struct {
   181  	ClusterID      string                 `json:"clusterID"`
   182  	Version        string                 `json:"version"`
   183  	TemplateName   string                 `json:"addonTemplateName"`
   184  	TemplateType   string                 `json:"addonTemplateType"`
   185  	TemplateLabels []string               `json:"addonTemplateLabels"`
   186  	Descrition     string                 `json:"descrition"`
   187  	Values         map[string]interface{} `json:"values"`
   188  }
   189  
   190  type Versions struct {
   191  	Version           string                 `json:"version"`
   192  	Input             map[string]interface{} `json:"input"`
   193  	Stable            bool                   `json:"stable"`
   194  	Translate         map[string]interface{} `json:"translate"`
   195  	UpdateTimestamp   string                 `json:"updateTimestamp"`
   196  	CreationTimestamp string                 `json:"creationTimestamp"`
   197  }
   198  
   199  type InstanceStatus struct {
   200  	Status         string   `json:"status"`
   201  	Reason         string   `json:"Reason"`
   202  	Message        string   `json:"message"`
   203  	TargetVersions []string `json:"targetVersions"`
   204  	CurrentVersion Versions `json:"currentVersion"`
   205  }
   206  
   207  type AddonInstance struct {
   208  	// API type, fixed value Addon
   209  	Kind string `json:"kind" required:"true"`
   210  	// API version, fixed value v3
   211  	ApiVersion string `json:"apiVersion" required:"true"`
   212  	// Metadata of an Addon
   213  	Metadata InstanceMetadata `json:"metadata" required:"true"`
   214  	// Specifications of an Addon
   215  	Spec AddonInstanceSpec `json:"spec" required:"true"`
   216  	// Status of an Addon
   217  	Status InstanceStatus `json:"status"`
   218  }
   219  
   220  type AddonInstanceList struct {
   221  	// API type, fixed value Addon
   222  	Kind string `json:"kind" required:"true"`
   223  	// API version, fixed value v3
   224  	ApiVersion string `json:"apiVersion" required:"true"`
   225  	// Metadata - Basic information about the add-on. A collection of attributes.
   226  	Metadata string `json:"metadata"`
   227  	// Add-on template list
   228  	Items []AddonInstance `json:"items" required:"true"`
   229  }
   230  
   231  func (r ListInstanceResult) Extract() (*AddonInstanceList, error) {
   232  	s := new(AddonInstanceList)
   233  	err := r.ExtractInto(s)
   234  	if err != nil {
   235  		return nil, err
   236  	}
   237  	return s, err
   238  }