From 1a8fd626ee2b9472a38f7de7437a8fba32c3ba74 Mon Sep 17 00:00:00 2001 From: Olivier Cano Date: Mon, 21 Oct 2019 17:19:53 +0200 Subject: [PATCH] feat: update generated apis (#218) - fix: placement group - feat: ANY security group rule - doc: default message doc --- api/account/v2alpha1/account_sdk.go | 2 + api/baremetal/v1alpha1/baremetal_sdk.go | 7 + api/instance/v1/instance_sdk.go | 483 ++++++++++++------------ api/k8s/v1beta3/k8s_sdk.go | 56 +-- api/lb/v1/lb_sdk.go | 54 +-- api/registry/v1/registry_sdk.go | 6 + 6 files changed, 286 insertions(+), 322 deletions(-) diff --git a/api/account/v2alpha1/account_sdk.go b/api/account/v2alpha1/account_sdk.go index 9bb366f45..56ad1fc56 100644 --- a/api/account/v2alpha1/account_sdk.go +++ b/api/account/v2alpha1/account_sdk.go @@ -88,12 +88,14 @@ func (enum *ListSSHKeysRequestOrderBy) UnmarshalJSON(data []byte) error { return nil } +// ListSSHKeysResponse list ssh keys response type ListSSHKeysResponse struct { SSHKeys []*SSHKey `json:"ssh_keys"` TotalCount uint32 `json:"total_count"` } +// SSHKey ssh key type SSHKey struct { ID string `json:"id"` diff --git a/api/baremetal/v1alpha1/baremetal_sdk.go b/api/baremetal/v1alpha1/baremetal_sdk.go index 205a2adcc..092c69dac 100644 --- a/api/baremetal/v1alpha1/baremetal_sdk.go +++ b/api/baremetal/v1alpha1/baremetal_sdk.go @@ -328,6 +328,7 @@ func (enum *ServerStatus) UnmarshalJSON(data []byte) error { return nil } +// IP ip type IP struct { // ID iD of the IP ID string `json:"id"` @@ -347,6 +348,7 @@ type IP struct { ReverseStatusMessage *string `json:"reverse_status_message"` } +// ListServerEventsResponse list server events response type ListServerEventsResponse struct { // TotalCount total count of matching events TotalCount uint32 `json:"total_count"` @@ -354,6 +356,7 @@ type ListServerEventsResponse struct { Event []*ServerEvent `json:"event"` } +// ListServersResponse list servers response type ListServersResponse struct { // TotalCount total count of matching servers TotalCount uint32 `json:"total_count"` @@ -361,6 +364,7 @@ type ListServersResponse struct { Servers []*Server `json:"servers"` } +// RemoteServerAccess remote server access type RemoteServerAccess struct { // URL uRL to access to the server console URL string `json:"url"` @@ -372,6 +376,7 @@ type RemoteServerAccess struct { ExpiresAt time.Time `json:"expires_at"` } +// Server server type Server struct { // ID iD of the server ID string `json:"id"` @@ -405,6 +410,7 @@ type Server struct { BootType ServerBootType `json:"boot_type"` } +// ServerEvent server event type ServerEvent struct { // ID iD of the server for whom the action will be applied ID string `json:"id"` @@ -416,6 +422,7 @@ type ServerEvent struct { CreatedAt time.Time `json:"created_at"` } +// ServerInstall server install type ServerInstall struct { // OsID iD of the OS OsID string `json:"os_id"` diff --git a/api/instance/v1/instance_sdk.go b/api/instance/v1/instance_sdk.go index d54d2046f..5ea7405bc 100644 --- a/api/instance/v1/instance_sdk.go +++ b/api/instance/v1/instance_sdk.go @@ -80,135 +80,101 @@ func (enum *Arch) UnmarshalJSON(data []byte) error { return nil } -type ComputeClusterPolicyMode string - -const ( - // ComputeClusterPolicyModeOptional is [insert doc]. - ComputeClusterPolicyModeOptional = ComputeClusterPolicyMode("optional") - // ComputeClusterPolicyModeEnforced is [insert doc]. - ComputeClusterPolicyModeEnforced = ComputeClusterPolicyMode("enforced") -) - -func (enum ComputeClusterPolicyMode) String() string { - if enum == "" { - // return default value if empty - return "optional" - } - return string(enum) -} - -func (enum ComputeClusterPolicyMode) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(`"%s"`, enum)), nil -} - -func (enum *ComputeClusterPolicyMode) UnmarshalJSON(data []byte) error { - tmp := "" - - if err := json.Unmarshal(data, &tmp); err != nil { - return err - } - - *enum = ComputeClusterPolicyMode(ComputeClusterPolicyMode(tmp).String()) - return nil -} - -type ComputeClusterPolicyType string +type ImageState string const ( - // ComputeClusterPolicyTypeMaxAvailability is [insert doc]. - ComputeClusterPolicyTypeMaxAvailability = ComputeClusterPolicyType("max_availability") - // ComputeClusterPolicyTypeLowLatency is [insert doc]. - ComputeClusterPolicyTypeLowLatency = ComputeClusterPolicyType("low_latency") + // ImageStateAvailable is [insert doc]. + ImageStateAvailable = ImageState("available") + // ImageStateCreating is [insert doc]. + ImageStateCreating = ImageState("creating") + // ImageStateError is [insert doc]. + ImageStateError = ImageState("error") ) -func (enum ComputeClusterPolicyType) String() string { +func (enum ImageState) String() string { if enum == "" { // return default value if empty - return "max_availability" + return "available" } return string(enum) } -func (enum ComputeClusterPolicyType) MarshalJSON() ([]byte, error) { +func (enum ImageState) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, enum)), nil } -func (enum *ComputeClusterPolicyType) UnmarshalJSON(data []byte) error { +func (enum *ImageState) UnmarshalJSON(data []byte) error { tmp := "" if err := json.Unmarshal(data, &tmp); err != nil { return err } - *enum = ComputeClusterPolicyType(ComputeClusterPolicyType(tmp).String()) + *enum = ImageState(ImageState(tmp).String()) return nil } -type GetServerTypesAvailabilityResponseAvailability string +type PlacementGroupPolicyMode string const ( - // GetServerTypesAvailabilityResponseAvailabilityAvailable is [insert doc]. - GetServerTypesAvailabilityResponseAvailabilityAvailable = GetServerTypesAvailabilityResponseAvailability("available") - // GetServerTypesAvailabilityResponseAvailabilityScarce is [insert doc]. - GetServerTypesAvailabilityResponseAvailabilityScarce = GetServerTypesAvailabilityResponseAvailability("scarce") - // GetServerTypesAvailabilityResponseAvailabilityShortage is [insert doc]. - GetServerTypesAvailabilityResponseAvailabilityShortage = GetServerTypesAvailabilityResponseAvailability("shortage") + // PlacementGroupPolicyModeOptional is [insert doc]. + PlacementGroupPolicyModeOptional = PlacementGroupPolicyMode("optional") + // PlacementGroupPolicyModeEnforced is [insert doc]. + PlacementGroupPolicyModeEnforced = PlacementGroupPolicyMode("enforced") ) -func (enum GetServerTypesAvailabilityResponseAvailability) String() string { +func (enum PlacementGroupPolicyMode) String() string { if enum == "" { // return default value if empty - return "available" + return "optional" } return string(enum) } -func (enum GetServerTypesAvailabilityResponseAvailability) MarshalJSON() ([]byte, error) { +func (enum PlacementGroupPolicyMode) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, enum)), nil } -func (enum *GetServerTypesAvailabilityResponseAvailability) UnmarshalJSON(data []byte) error { +func (enum *PlacementGroupPolicyMode) UnmarshalJSON(data []byte) error { tmp := "" if err := json.Unmarshal(data, &tmp); err != nil { return err } - *enum = GetServerTypesAvailabilityResponseAvailability(GetServerTypesAvailabilityResponseAvailability(tmp).String()) + *enum = PlacementGroupPolicyMode(PlacementGroupPolicyMode(tmp).String()) return nil } -type ImageState string +type PlacementGroupPolicyType string const ( - // ImageStateAvailable is [insert doc]. - ImageStateAvailable = ImageState("available") - // ImageStateCreating is [insert doc]. - ImageStateCreating = ImageState("creating") - // ImageStateError is [insert doc]. - ImageStateError = ImageState("error") + // PlacementGroupPolicyTypeMaxAvailability is [insert doc]. + PlacementGroupPolicyTypeMaxAvailability = PlacementGroupPolicyType("max_availability") + // PlacementGroupPolicyTypeLowLatency is [insert doc]. + PlacementGroupPolicyTypeLowLatency = PlacementGroupPolicyType("low_latency") ) -func (enum ImageState) String() string { +func (enum PlacementGroupPolicyType) String() string { if enum == "" { // return default value if empty - return "available" + return "max_availability" } return string(enum) } -func (enum ImageState) MarshalJSON() ([]byte, error) { +func (enum PlacementGroupPolicyType) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf(`"%s"`, enum)), nil } -func (enum *ImageState) UnmarshalJSON(data []byte) error { +func (enum *PlacementGroupPolicyType) UnmarshalJSON(data []byte) error { tmp := "" if err := json.Unmarshal(data, &tmp); err != nil { return err } - *enum = ImageState(ImageState(tmp).String()) + *enum = PlacementGroupPolicyType(PlacementGroupPolicyType(tmp).String()) return nil } @@ -317,6 +283,8 @@ const ( SecurityGroupRuleProtocolUDP = SecurityGroupRuleProtocol("UDP") // SecurityGroupRuleProtocolICMP is [insert doc]. SecurityGroupRuleProtocolICMP = SecurityGroupRuleProtocol("ICMP") + // SecurityGroupRuleProtocolANY is [insert doc]. + SecurityGroupRuleProtocolANY = SecurityGroupRuleProtocol("ANY") ) func (enum SecurityGroupRuleProtocol) String() string { @@ -452,6 +420,40 @@ func (enum *ServerState) UnmarshalJSON(data []byte) error { return nil } +type ServerTypesAvailability string + +const ( + // ServerTypesAvailabilityAvailable is [insert doc]. + ServerTypesAvailabilityAvailable = ServerTypesAvailability("available") + // ServerTypesAvailabilityScarce is [insert doc]. + ServerTypesAvailabilityScarce = ServerTypesAvailability("scarce") + // ServerTypesAvailabilityShortage is [insert doc]. + ServerTypesAvailabilityShortage = ServerTypesAvailability("shortage") +) + +func (enum ServerTypesAvailability) String() string { + if enum == "" { + // return default value if empty + return "available" + } + return string(enum) +} + +func (enum ServerTypesAvailability) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(`"%s"`, enum)), nil +} + +func (enum *ServerTypesAvailability) UnmarshalJSON(data []byte) error { + tmp := "" + + if err := json.Unmarshal(data, &tmp); err != nil { + return err + } + + *enum = ServerTypesAvailability(ServerTypesAvailability(tmp).String()) + return nil +} + type SnapshotState string const ( @@ -590,6 +592,7 @@ func (enum *VolumeType) UnmarshalJSON(data []byte) error { return nil } +// Bootscript bootscript type Bootscript struct { // Bootcmdargs display the bootscript parameters Bootcmdargs string `json:"bootcmdargs"` @@ -615,37 +618,6 @@ type Bootscript struct { Arch Arch `json:"arch"` } -type ComputeCluster struct { - // ID display compute-cluster unique ID - ID string `json:"id"` - // Name display compute-cluster name - Name string `json:"name"` - // Organization display compute-cluster organization - Organization string `json:"organization"` - // PolicyMode select the failling mode when the placement cannot be respected, either optional or enforced - // - // Default value: optional - PolicyMode ComputeClusterPolicyMode `json:"policy_mode"` - // PolicyType select the behavior of the compute-cluster, either low_latency (group) or max_availability (spread) - // - // Default value: max_availability - PolicyType ComputeClusterPolicyType `json:"policy_type"` - // PolicyRespected returns true if the policy is respected, false otherwise - PolicyRespected bool `json:"policy_respected"` -} - -type ComputeClusterServer struct { - ID string `json:"id"` - - Name string `json:"name"` - - PolicyRespected bool `json:"policy_respected"` -} - -type CreateComputeClusterResponse struct { - ComputeCluster *ComputeCluster `json:"compute_cluster"` -} - type CreateIPResponse struct { IP *IP `json:"ip"` @@ -658,6 +630,10 @@ type CreateImageResponse struct { Location string `json:"Location"` } +type CreatePlacementGroupResponse struct { + PlacementGroup *PlacementGroup `json:"placement_group"` +} + type CreateSecurityGroupResponse struct { SecurityGroup *SecurityGroup `json:"security_group"` } @@ -704,14 +680,6 @@ type GetBootscriptResponse struct { Bootscript *Bootscript `json:"bootscript"` } -type GetComputeClusterResponse struct { - ComputeCluster *ComputeCluster `json:"compute_cluster"` -} - -type GetComputeClusterServersResponse struct { - Servers []*ComputeClusterServer `json:"servers"` -} - type GetDashboardResponse struct { Dashboard *Dashboard `json:"dashboard"` } @@ -724,6 +692,14 @@ type GetImageResponse struct { Image *Image `json:"image"` } +type GetPlacementGroupResponse struct { + PlacementGroup *PlacementGroup `json:"placement_group"` +} + +type GetPlacementGroupServersResponse struct { + Servers []*PlacementGroupServer `json:"servers"` +} + type GetSecurityGroupResponse struct { SecurityGroup *SecurityGroup `json:"security_group"` } @@ -737,7 +713,7 @@ type GetServerResponse struct { } type GetServerTypesAvailabilityResponse struct { - Servers map[string]GetServerTypesAvailabilityResponseAvailability `json:"servers"` + Servers map[string]ServerTypesAvailability `json:"servers"` } type GetSnapshotResponse struct { @@ -796,12 +772,6 @@ type ListBootscriptsResponse struct { TotalCount uint32 `json:"total_count"` } -type ListComputeClustersResponse struct { - ComputeClusters []*ComputeCluster `json:"compute_clusters"` - - TotalCount uint32 `json:"total_count"` -} - type ListIPsResponse struct { IPs []*IP `json:"ips"` @@ -814,6 +784,12 @@ type ListImagesResponse struct { TotalCount uint32 `json:"total_count"` } +type ListPlacementGroupsResponse struct { + PlacementGroups []*PlacementGroup `json:"placement_groups"` + + TotalCount uint32 `json:"total_count"` +} + type ListSecurityGroupRulesResponse struct { Rules []*SecurityGroupRule `json:"rules"` @@ -864,6 +840,35 @@ type NullableStringValue struct { Value string `json:"value,omitempty"` } +// PlacementGroup placement group +type PlacementGroup struct { + // ID display placement group unique ID + ID string `json:"id"` + // Name display placement group name + Name string `json:"name"` + // Organization display placement group organization + Organization string `json:"organization"` + // PolicyMode select the failling mode when the placement cannot be respected, either optional or enforced + // + // Default value: optional + PolicyMode PlacementGroupPolicyMode `json:"policy_mode"` + // PolicyType select the behavior of the placement group, either low_latency (group) or max_availability (spread) + // + // Default value: max_availability + PolicyType PlacementGroupPolicyType `json:"policy_type"` + // PolicyRespected returns true if the policy is respected, false otherwise + PolicyRespected bool `json:"policy_respected"` +} + +type PlacementGroupServer struct { + ID string `json:"id"` + + Name string `json:"name"` + + PolicyRespected bool `json:"policy_respected"` +} + +// SecurityGroup security group type SecurityGroup struct { // ID display the security groups' unique ID ID string `json:"id"` @@ -933,6 +938,7 @@ type SecurityGroupTemplate struct { Name string `json:"name,omitempty"` } +// Server server type Server struct { // ID display the server unique ID ID string `json:"id"` @@ -990,14 +996,15 @@ type Server struct { // // Default value: x86_64 Arch Arch `json:"arch"` - // ComputeCluster display the server ComputeCluster - ComputeCluster *ComputeCluster `json:"compute_cluster"` + // PlacementGroup display the server placement group + PlacementGroup *PlacementGroup `json:"placement_group"` } type ServerActionResponse struct { Task *Task `json:"task"` } +// ServerIP server. ip type ServerIP struct { // ID display the unique ID of the IP address ID string `json:"id"` @@ -1007,6 +1014,7 @@ type ServerIP struct { Dynamic bool `json:"dynamic"` } +// ServerIPv6 server. ipv6 type ServerIPv6 struct { // Address display the server IPv6 IP-Address Address net.IP `json:"address"` @@ -1089,12 +1097,12 @@ type ServerTypeVolumeConstraintsByType struct { LSSD *ServerTypeVolumeConstraintSizes `json:"l_ssd"` } -type SetComputeClusterResponse struct { - ComputeClusterID string `json:"compute_cluster_id"` +type SetPlacementGroupResponse struct { + PlacementGroupID string `json:"placement_group_id"` } -type SetComputeClusterServersResponse struct { - Servers []*ComputeClusterServer `json:"servers"` +type SetPlacementGroupServersResponse struct { + Servers []*PlacementGroupServer `json:"servers"` } type Snapshot struct { @@ -1127,6 +1135,7 @@ type SnapshotBaseVolume struct { Name string `json:"name"` } +// Task task type Task struct { // ID the unique ID of the task ID string `json:"id"` @@ -1148,22 +1157,23 @@ type Task struct { HrefResult string `json:"href_result"` } -type UpdateComputeClusterResponse struct { - ComputeClusterID string `json:"compute_cluster_id"` +type UpdateIPResponse struct { + IP *IP `json:"ip"` } -type UpdateComputeClusterServersResponse struct { - Servers []*ComputeClusterServer `json:"servers"` +type UpdatePlacementGroupResponse struct { + PlacementGroupID string `json:"placement_group_id"` } -type UpdateIPResponse struct { - IP *IP `json:"ip"` +type UpdatePlacementGroupServersResponse struct { + Servers []*PlacementGroupServer `json:"servers"` } type UpdateServerResponse struct { Server *Server `json:"server"` } +// Volume volume type Volume struct { // ID display the volumes unique ID ID string `json:"id"` @@ -1203,6 +1213,7 @@ type VolumeSummary struct { VolumeType VolumeType `json:"volume_type"` } +// VolumeTemplate volume template type VolumeTemplate struct { // ID display the volumes unique ID ID string `json:"id,omitempty"` @@ -1218,26 +1229,32 @@ type VolumeTemplate struct { Organization string `json:"organization,omitempty"` } +// setIPResponse set ip response type setIPResponse struct { IP *IP `json:"ip"` } +// setImageResponse set image response type setImageResponse struct { Image *Image `json:"image"` } +// setSecurityGroupResponse set security group response type setSecurityGroupResponse struct { SecurityGroup *SecurityGroup `json:"security_group"` } +// setSecurityGroupRuleResponse set security group rule response type setSecurityGroupRuleResponse struct { Rule *SecurityGroupRule `json:"rule"` } +// setServerResponse set server response type setServerResponse struct { Server *Server `json:"server"` } +// setSnapshotResponse set snapshot response type setSnapshotResponse struct { Snapshot *Snapshot `json:"snapshot"` } @@ -1430,22 +1447,22 @@ type CreateServerRequest struct { DynamicIPRequired *bool `json:"dynamic_ip_required,omitempty"` // CommercialType define the server commercial type (i.e. GP1-S) CommercialType string `json:"commercial_type,omitempty"` - // Image define the server image id + // Image the server image ID or label Image string `json:"image,omitempty"` - // Volumes define the volumes attached to the server + // Volumes the volumes attached to the server Volumes map[string]*VolumeTemplate `json:"volumes,omitempty"` - // EnableIPv6 define if IPv6 is enabled on the server + // EnableIPv6 true if IPv6 is enabled on the server EnableIPv6 bool `json:"enable_ipv6,omitempty"` - // PublicIP define the public IPv4 attached to the server + // PublicIP the public IPv4 attached to the server PublicIP string `json:"public_ip,omitempty"` - // Organization define the server organization + // Organization the server organization ID Organization string `json:"organization,omitempty"` - // Tags define the server tags + // Tags the server tags Tags []string `json:"tags,omitempty"` - // SecurityGroup define the security group id + // SecurityGroup the security group ID SecurityGroup string `json:"security_group,omitempty"` - // ComputeCluster computeCluster key if server must be part of a ComputeCluster - ComputeCluster string `json:"compute_cluster,omitempty"` + // PlacementGroup placement group ID if server must be part of a placement group + PlacementGroup string `json:"placement_group,omitempty"` } // createServer create server @@ -1626,8 +1643,8 @@ type setServerRequest struct { // // Default value: x86_64 Arch Arch `json:"arch"` - // ComputeCluster display the server ComputeCluster - ComputeCluster *ComputeCluster `json:"compute_cluster"` + // PlacementGroup display the server placement group + PlacementGroup *PlacementGroup `json:"placement_group"` } func (s *API) setServer(req *setServerRequest, opts ...scw.RequestOption) (*setServerResponse, error) { @@ -1691,8 +1708,8 @@ type UpdateServerRequest struct { Protected *bool `json:"protected,omitempty"` SecurityGroup *SecurityGroupTemplate `json:"security_group,omitempty"` - - ComputeCluster *NullableStringValue `json:"compute_cluster,omitempty"` + // PlacementGroup placement group ID if server must be part of a placement group + PlacementGroup *NullableStringValue `json:"placement_group,omitempty"` } // updateServer update server @@ -3282,7 +3299,7 @@ func (s *API) setSecurityGroupRule(req *setSecurityGroupRuleRequest, opts ...scw return &resp, nil } -type ListComputeClustersRequest struct { +type ListPlacementGroupsRequest struct { Zone scw.Zone `json:"-"` // PerPage a positive integer lower or equal to 100 to select the number of items to display // @@ -3290,16 +3307,16 @@ type ListComputeClustersRequest struct { PerPage *uint32 `json:"-"` // Page a positive integer to choose the page to display Page *int32 `json:"-"` - // Organization list only compute-clusters of this organization + // Organization list only placement groups of this organization Organization *string `json:"-"` - // Name filter compute-clusters by name (for eg. "cluster1" will return "cluster100" and "cluster1" but not "foo") + // Name filter placement groups by name (for eg. "cluster1" will return "cluster100" and "cluster1" but not "foo") Name *string `json:"-"` } -// ListComputeClusters list compute-clusters +// ListPlacementGroups list placement groups // -// List all compute-clusters -func (s *API) ListComputeClusters(req *ListComputeClustersRequest, opts ...scw.RequestOption) (*ListComputeClustersResponse, error) { +// List all placement groups +func (s *API) ListPlacementGroups(req *ListPlacementGroupsRequest, opts ...scw.RequestOption) (*ListPlacementGroupsResponse, error) { var err error if req.Zone == "" { @@ -3324,12 +3341,12 @@ func (s *API) ListComputeClusters(req *ListComputeClustersRequest, opts ...scw.R scwReq := &scw.ScalewayRequest{ Method: "GET", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups", Query: query, Headers: http.Header{}, } - var resp ListComputeClustersResponse + var resp ListPlacementGroupsResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3340,24 +3357,24 @@ func (s *API) ListComputeClusters(req *ListComputeClustersRequest, opts ...scw.R // UnsafeGetTotalCount should not be used // Internal usage only -func (r *ListComputeClustersResponse) UnsafeGetTotalCount() uint32 { +func (r *ListPlacementGroupsResponse) UnsafeGetTotalCount() uint32 { return r.TotalCount } // UnsafeAppend should not be used // Internal usage only -func (r *ListComputeClustersResponse) UnsafeAppend(res interface{}) (uint32, scw.SdkError) { - results, ok := res.(*ListComputeClustersResponse) +func (r *ListPlacementGroupsResponse) UnsafeAppend(res interface{}) (uint32, scw.SdkError) { + results, ok := res.(*ListPlacementGroupsResponse) if !ok { return 0, errors.New("%T type cannot be appended to type %T", res, r) } - r.ComputeClusters = append(r.ComputeClusters, results.ComputeClusters...) - r.TotalCount += uint32(len(results.ComputeClusters)) - return uint32(len(results.ComputeClusters)), nil + r.PlacementGroups = append(r.PlacementGroups, results.PlacementGroups...) + r.TotalCount += uint32(len(results.PlacementGroups)) + return uint32(len(results.PlacementGroups)), nil } -type CreateComputeClusterRequest struct { +type CreatePlacementGroupRequest struct { Zone scw.Zone `json:"-"` Name string `json:"name,omitempty"` @@ -3366,17 +3383,17 @@ type CreateComputeClusterRequest struct { // PolicyMode // // Default value: optional - PolicyMode ComputeClusterPolicyMode `json:"policy_mode"` + PolicyMode PlacementGroupPolicyMode `json:"policy_mode"` // PolicyType // // Default value: max_availability - PolicyType ComputeClusterPolicyType `json:"policy_type"` + PolicyType PlacementGroupPolicyType `json:"policy_type"` } -// CreateComputeCluster create compute-cluster +// CreatePlacementGroup create placement group // -// Create a new compute-cluster -func (s *API) CreateComputeCluster(req *CreateComputeClusterRequest, opts ...scw.RequestOption) (*CreateComputeClusterResponse, error) { +// Create a new placement group +func (s *API) CreatePlacementGroup(req *CreatePlacementGroupRequest, opts ...scw.RequestOption) (*CreatePlacementGroupResponse, error) { var err error if req.Organization == "" { @@ -3395,7 +3412,7 @@ func (s *API) CreateComputeCluster(req *CreateComputeClusterRequest, opts ...scw scwReq := &scw.ScalewayRequest{ Method: "POST", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups", Headers: http.Header{}, } @@ -3404,7 +3421,7 @@ func (s *API) CreateComputeCluster(req *CreateComputeClusterRequest, opts ...scw return nil, err } - var resp CreateComputeClusterResponse + var resp CreatePlacementGroupResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3413,16 +3430,16 @@ func (s *API) CreateComputeCluster(req *CreateComputeClusterRequest, opts ...scw return &resp, nil } -type GetComputeClusterRequest struct { +type GetPlacementGroupRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` } -// GetComputeCluster get compute-cluster +// GetPlacementGroup get placement group // -// Get the given compute-cluster -func (s *API) GetComputeCluster(req *GetComputeClusterRequest, opts ...scw.RequestOption) (*GetComputeClusterResponse, error) { +// Get the given placement group +func (s *API) GetPlacementGroup(req *GetPlacementGroupRequest, opts ...scw.RequestOption) (*GetPlacementGroupResponse, error) { var err error if req.Zone == "" { @@ -3434,17 +3451,17 @@ func (s *API) GetComputeCluster(req *GetComputeClusterRequest, opts ...scw.Reque return nil, errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return nil, errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return nil, errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "GET", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "", Headers: http.Header{}, } - var resp GetComputeClusterResponse + var resp GetPlacementGroupResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3453,10 +3470,10 @@ func (s *API) GetComputeCluster(req *GetComputeClusterRequest, opts ...scw.Reque return &resp, nil } -type SetComputeClusterRequest struct { +type SetPlacementGroupRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` Name string `json:"name"` @@ -3464,17 +3481,17 @@ type SetComputeClusterRequest struct { // PolicyMode // // Default value: optional - PolicyMode ComputeClusterPolicyMode `json:"policy_mode"` + PolicyMode PlacementGroupPolicyMode `json:"policy_mode"` // PolicyType // // Default value: max_availability - PolicyType ComputeClusterPolicyType `json:"policy_type"` + PolicyType PlacementGroupPolicyType `json:"policy_type"` } -// SetComputeCluster set compute-cluster +// SetPlacementGroup set placement group // -// Set all parameters of the given compute-cluster -func (s *API) SetComputeCluster(req *SetComputeClusterRequest, opts ...scw.RequestOption) (*SetComputeClusterResponse, error) { +// Set all parameters of the given placement group +func (s *API) SetPlacementGroup(req *SetPlacementGroupRequest, opts ...scw.RequestOption) (*SetPlacementGroupResponse, error) { var err error if req.Organization == "" { @@ -3491,13 +3508,13 @@ func (s *API) SetComputeCluster(req *SetComputeClusterRequest, opts ...scw.Reque return nil, errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return nil, errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return nil, errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "PUT", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "", Headers: http.Header{}, } @@ -3506,7 +3523,7 @@ func (s *API) SetComputeCluster(req *SetComputeClusterRequest, opts ...scw.Reque return nil, err } - var resp SetComputeClusterResponse + var resp SetPlacementGroupResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3515,10 +3532,10 @@ func (s *API) SetComputeCluster(req *SetComputeClusterRequest, opts ...scw.Reque return &resp, nil } -type UpdateComputeClusterRequest struct { +type UpdatePlacementGroupRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` Name *string `json:"name,omitempty"` @@ -3526,17 +3543,17 @@ type UpdateComputeClusterRequest struct { // PolicyMode // // Default value: optional - PolicyMode ComputeClusterPolicyMode `json:"policy_mode"` + PolicyMode PlacementGroupPolicyMode `json:"policy_mode"` // PolicyType // // Default value: max_availability - PolicyType ComputeClusterPolicyType `json:"policy_type"` + PolicyType PlacementGroupPolicyType `json:"policy_type"` } -// UpdateComputeCluster update compute-cluster +// UpdatePlacementGroup update placement group // -// Update one or more parameter of the given compute-cluster -func (s *API) UpdateComputeCluster(req *UpdateComputeClusterRequest, opts ...scw.RequestOption) (*UpdateComputeClusterResponse, error) { +// Update one or more parameter of the given placement group +func (s *API) UpdatePlacementGroup(req *UpdatePlacementGroupRequest, opts ...scw.RequestOption) (*UpdatePlacementGroupResponse, error) { var err error if req.Zone == "" { @@ -3548,13 +3565,13 @@ func (s *API) UpdateComputeCluster(req *UpdateComputeClusterRequest, opts ...scw return nil, errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return nil, errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return nil, errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "PATCH", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "", Headers: http.Header{}, } @@ -3563,7 +3580,7 @@ func (s *API) UpdateComputeCluster(req *UpdateComputeClusterRequest, opts ...scw return nil, err } - var resp UpdateComputeClusterResponse + var resp UpdatePlacementGroupResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3572,16 +3589,16 @@ func (s *API) UpdateComputeCluster(req *UpdateComputeClusterRequest, opts ...scw return &resp, nil } -type DeleteComputeClusterRequest struct { +type DeletePlacementGroupRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` } -// DeleteComputeCluster delete the given compute-cluster +// DeletePlacementGroup delete the given placement group // -// Delete the given compute-cluster -func (s *API) DeleteComputeCluster(req *DeleteComputeClusterRequest, opts ...scw.RequestOption) error { +// Delete the given placement group +func (s *API) DeletePlacementGroup(req *DeletePlacementGroupRequest, opts ...scw.RequestOption) error { var err error if req.Zone == "" { @@ -3593,13 +3610,13 @@ func (s *API) DeleteComputeCluster(req *DeleteComputeClusterRequest, opts ...scw return errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "DELETE", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "", Headers: http.Header{}, } @@ -3610,16 +3627,16 @@ func (s *API) DeleteComputeCluster(req *DeleteComputeClusterRequest, opts ...scw return nil } -type GetComputeClusterServersRequest struct { +type GetPlacementGroupServersRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` } -// GetComputeClusterServers get compute-cluster servers +// GetPlacementGroupServers get placement group servers // -// Get all servers belonging to the given compute-cluster -func (s *API) GetComputeClusterServers(req *GetComputeClusterServersRequest, opts ...scw.RequestOption) (*GetComputeClusterServersResponse, error) { +// Get all servers belonging to the given placement group +func (s *API) GetPlacementGroupServers(req *GetPlacementGroupServersRequest, opts ...scw.RequestOption) (*GetPlacementGroupServersResponse, error) { var err error if req.Zone == "" { @@ -3631,17 +3648,17 @@ func (s *API) GetComputeClusterServers(req *GetComputeClusterServersRequest, opt return nil, errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return nil, errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return nil, errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "GET", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "/servers", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "/servers", Headers: http.Header{}, } - var resp GetComputeClusterServersResponse + var resp GetPlacementGroupServersResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3650,16 +3667,16 @@ func (s *API) GetComputeClusterServers(req *GetComputeClusterServersRequest, opt return &resp, nil } -type SetComputeClusterServersRequest struct { +type SetPlacementGroupServersRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` } -// SetComputeClusterServers set compute-cluster servers +// SetPlacementGroupServers set placement group servers // -// Set all servers belonging to the given compute-cluster -func (s *API) SetComputeClusterServers(req *SetComputeClusterServersRequest, opts ...scw.RequestOption) (*SetComputeClusterServersResponse, error) { +// Set all servers belonging to the given placement group +func (s *API) SetPlacementGroupServers(req *SetPlacementGroupServersRequest, opts ...scw.RequestOption) (*SetPlacementGroupServersResponse, error) { var err error if req.Zone == "" { @@ -3671,13 +3688,13 @@ func (s *API) SetComputeClusterServers(req *SetComputeClusterServersRequest, opt return nil, errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return nil, errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return nil, errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "PUT", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "/servers", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "/servers", Headers: http.Header{}, } @@ -3686,7 +3703,7 @@ func (s *API) SetComputeClusterServers(req *SetComputeClusterServersRequest, opt return nil, err } - var resp SetComputeClusterServersResponse + var resp SetPlacementGroupServersResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3695,16 +3712,16 @@ func (s *API) SetComputeClusterServers(req *SetComputeClusterServersRequest, opt return &resp, nil } -type UpdateComputeClusterServersRequest struct { +type UpdatePlacementGroupServersRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` } -// UpdateComputeClusterServers update compute-cluster servers +// UpdatePlacementGroupServers update placement group servers // -// Update all servers belonging to the given compute-cluster -func (s *API) UpdateComputeClusterServers(req *UpdateComputeClusterServersRequest, opts ...scw.RequestOption) (*UpdateComputeClusterServersResponse, error) { +// Update all servers belonging to the given placement group +func (s *API) UpdatePlacementGroupServers(req *UpdatePlacementGroupServersRequest, opts ...scw.RequestOption) (*UpdatePlacementGroupServersResponse, error) { var err error if req.Zone == "" { @@ -3716,13 +3733,13 @@ func (s *API) UpdateComputeClusterServers(req *UpdateComputeClusterServersReques return nil, errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return nil, errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return nil, errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "PATCH", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "/servers", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "/servers", Headers: http.Header{}, } @@ -3731,7 +3748,7 @@ func (s *API) UpdateComputeClusterServers(req *UpdateComputeClusterServersReques return nil, err } - var resp UpdateComputeClusterServersResponse + var resp UpdatePlacementGroupServersResponse err = s.client.Do(scwReq, &resp, opts...) if err != nil { @@ -3740,16 +3757,16 @@ func (s *API) UpdateComputeClusterServers(req *UpdateComputeClusterServersReques return &resp, nil } -type DeleteComputeClusterServersRequest struct { +type DeletePlacementGroupServersRequest struct { Zone scw.Zone `json:"-"` - ComputeClusterID string `json:"-"` + PlacementGroupID string `json:"-"` } -// DeleteComputeClusterServers delete compute-cluster servers +// DeletePlacementGroupServers delete placement group servers // -// Delete all servers from the given compute-cluster -func (s *API) DeleteComputeClusterServers(req *DeleteComputeClusterServersRequest, opts ...scw.RequestOption) error { +// Delete all servers from the given placement group +func (s *API) DeletePlacementGroupServers(req *DeletePlacementGroupServersRequest, opts ...scw.RequestOption) error { var err error if req.Zone == "" { @@ -3761,13 +3778,13 @@ func (s *API) DeleteComputeClusterServers(req *DeleteComputeClusterServersReques return errors.New("field Zone cannot be empty in request") } - if fmt.Sprint(req.ComputeClusterID) == "" { - return errors.New("field ComputeClusterID cannot be empty in request") + if fmt.Sprint(req.PlacementGroupID) == "" { + return errors.New("field PlacementGroupID cannot be empty in request") } scwReq := &scw.ScalewayRequest{ Method: "DELETE", - Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/compute_clusters/" + fmt.Sprint(req.ComputeClusterID) + "/servers", + Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/placement_groups/" + fmt.Sprint(req.PlacementGroupID) + "/servers", Headers: http.Header{}, } diff --git a/api/k8s/v1beta3/k8s_sdk.go b/api/k8s/v1beta3/k8s_sdk.go index 915ca397b..a39af9c4a 100644 --- a/api/k8s/v1beta3/k8s_sdk.go +++ b/api/k8s/v1beta3/k8s_sdk.go @@ -94,48 +94,6 @@ func (enum *ClusterStatus) UnmarshalJSON(data []byte) error { return nil } -type ClusterSubStatus string - -const ( - // ClusterSubStatusNoDetails is [insert doc]. - ClusterSubStatusNoDetails = ClusterSubStatus("no_details") - // ClusterSubStatusDeployLoadbalancer is [insert doc]. - ClusterSubStatusDeployLoadbalancer = ClusterSubStatus("deploy_loadbalancer") - // ClusterSubStatusDeployEtcd is [insert doc]. - ClusterSubStatusDeployEtcd = ClusterSubStatus("deploy_etcd") - // ClusterSubStatusDeployControlplane is [insert doc]. - ClusterSubStatusDeployControlplane = ClusterSubStatus("deploy_controlplane") - // ClusterSubStatusDeployNodes is [insert doc]. - ClusterSubStatusDeployNodes = ClusterSubStatus("deploy_nodes") - // ClusterSubStatusUpdatingEtcd is [insert doc]. - ClusterSubStatusUpdatingEtcd = ClusterSubStatus("updating_etcd") - // ClusterSubStatusUpdatingControlplane is [insert doc]. - ClusterSubStatusUpdatingControlplane = ClusterSubStatus("updating_controlplane") -) - -func (enum ClusterSubStatus) String() string { - if enum == "" { - // return default value if empty - return "no_details" - } - return string(enum) -} - -func (enum ClusterSubStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(`"%s"`, enum)), nil -} - -func (enum *ClusterSubStatus) UnmarshalJSON(data []byte) error { - tmp := "" - - if err := json.Unmarshal(data, &tmp); err != nil { - return err - } - - *enum = ClusterSubStatus(ClusterSubStatus(tmp).String()) - return nil -} - type ListClustersRequestOrderBy string const ( @@ -362,6 +320,7 @@ func (enum *PoolStatus) UnmarshalJSON(data []byte) error { return nil } +// Cluster cluster type Cluster struct { // ID display the cluster unique ID ID string `json:"id"` @@ -379,10 +338,6 @@ type Cluster struct { // // Default value: unknown Status ClusterStatus `json:"status"` - // SubStatus - // - // Default value: no_details - SubStatus ClusterSubStatus `json:"sub_status"` // Version display the cluster version Version string `json:"version"` // Cni display the cni model @@ -455,32 +410,38 @@ type CreateClusterRequestDefaultPoolConfig struct { Autohealing bool `json:"autohealing"` } +// ListClusterAvailableVersionsResponse list cluster available versions response type ListClusterAvailableVersionsResponse struct { Versions []*Version `json:"versions"` } +// ListClustersResponse list clusters response type ListClustersResponse struct { TotalCount uint32 `json:"total_count"` Clusters []*Cluster `json:"clusters"` } +// ListNodesResponse list nodes response type ListNodesResponse struct { TotalCount uint32 `json:"total_count"` Nodes []*Node `json:"nodes"` } +// ListPoolsResponse list pools response type ListPoolsResponse struct { TotalCount uint32 `json:"total_count"` Pools []*Pool `json:"pools"` } +// ListVersionsResponse list versions response type ListVersionsResponse struct { Versions []*Version `json:"versions"` } +// Node node type Node struct { // ID display node unique ID ID string `json:"id"` @@ -508,6 +469,7 @@ type Node struct { UpdatedAt time.Time `json:"updated_at"` } +// Pool pool type Pool struct { // ID display pool unique ID ID string `json:"id"` @@ -549,6 +511,7 @@ type Pool struct { ContainerRuntime string `json:"container_runtime"` } +// ResetClusterAdminTokenResponse reset cluster admin token response type ResetClusterAdminTokenResponse struct { } @@ -568,6 +531,7 @@ type UpdateClusterRequestAutoscalerConfig struct { ExpendablePodsPriorityCutoff *int32 `json:"expendable_pods_priority_cutoff"` } +// Version version type Version struct { Name string `json:"name"` diff --git a/api/lb/v1/lb_sdk.go b/api/lb/v1/lb_sdk.go index 058490d89..4abdd3f54 100644 --- a/api/lb/v1/lb_sdk.go +++ b/api/lb/v1/lb_sdk.go @@ -718,6 +718,7 @@ type ACLMatch struct { Invert bool `json:"invert"` } +// Backend backend type Backend struct { ID string `json:"id"` @@ -854,6 +855,7 @@ type CreateCertificateRequestLetsencryptConfig struct { SubjectAlternativeName []string `json:"subject_alternative_name"` } +// Frontend frontend type Frontend struct { ID string `json:"id"` @@ -902,6 +904,7 @@ func (m Frontend) MarshalJSON() ([]byte, error) { return json.Marshal(tmp) } +// HealthCheck health check type HealthCheck struct { // MysqlConfig the check requires MySQL >=3.22, for older versions, use TCP check // Precisely one of HTTPConfig, HTTPSConfig, LdapConfig, MysqlConfig, PgsqlConfig, RedisConfig, TCPConfig must be set. @@ -1023,6 +1026,7 @@ type HealthCheckRedisConfig struct { type HealthCheckTCPConfig struct { } +// IP ip type IP struct { ID string `json:"id"` @@ -1049,6 +1053,7 @@ type Instance struct { Region scw.Region `json:"region"` } +// Lb lb type Lb struct { ID string `json:"id"` @@ -1077,6 +1082,7 @@ type Lb struct { Region scw.Region `json:"region"` } +// LbStats lb stats type LbStats struct { // BackendServersStats list stats object of your loadbalancer (See the BackendServerStats object description) BackendServersStats []*BackendServerStats `json:"backend_servers_stats"` @@ -1094,6 +1100,7 @@ type LbType struct { Region scw.Region `json:"region"` } +// ListACLResponse list acl response type ListACLResponse struct { // ACLs list of Acl object (see Acl object description) ACLs []*ACL `json:"acls"` @@ -1101,6 +1108,7 @@ type ListACLResponse struct { TotalCount uint32 `json:"total_count"` } +// ListBackendsResponse list backends response type ListBackendsResponse struct { // Backends list Backend objects of a Load Balancer Backends []*Backend `json:"backends"` @@ -1114,6 +1122,7 @@ type ListCertificatesResponse struct { TotalCount uint32 `json:"total_count"` } +// ListFrontendsResponse list frontends response type ListFrontendsResponse struct { // Frontends list frontends object of your loadbalancer Frontends []*Frontend `json:"frontends"` @@ -1121,6 +1130,7 @@ type ListFrontendsResponse struct { TotalCount uint32 `json:"total_count"` } +// ListIPsResponse list ips response type ListIPsResponse struct { // IPs list IP address object IPs []*IP `json:"ips"` @@ -1134,6 +1144,7 @@ type ListLbTypesResponse struct { TotalCount uint32 `json:"total_count"` } +// ListLbsResponse list lbs response type ListLbsResponse struct { Lbs []*Lb `json:"lbs"` @@ -1574,49 +1585,6 @@ func (s *API) ReleaseIP(req *ReleaseIPRequest, opts ...scw.RequestOption) error return nil } -type UpdateIPRequest struct { - Region scw.Region `json:"-"` - // IPID iP address ID - IPID string `json:"-"` - // Reverse reverse DNS - Reverse *string `json:"-"` -} - -func (s *API) UpdateIP(req *UpdateIPRequest, opts ...scw.RequestOption) (*IP, error) { - var err error - - if req.Region == "" { - defaultRegion, _ := s.client.GetDefaultRegion() - req.Region = defaultRegion - } - - query := url.Values{} - parameter.AddToQuery(query, "reverse", req.Reverse) - - if fmt.Sprint(req.Region) == "" { - return nil, errors.New("field Region cannot be empty in request") - } - - if fmt.Sprint(req.IPID) == "" { - return nil, errors.New("field IPID cannot be empty in request") - } - - scwReq := &scw.ScalewayRequest{ - Method: "PATCH", - Path: "/lb/v1/regions/" + fmt.Sprint(req.Region) + "/ips/" + fmt.Sprint(req.IPID) + "", - Query: query, - Headers: http.Header{}, - } - - var resp IP - - err = s.client.Do(scwReq, &resp, opts...) - if err != nil { - return nil, err - } - return &resp, nil -} - type ListBackendsRequest struct { Region scw.Region `json:"-"` // LbID load Balancer ID diff --git a/api/registry/v1/registry_sdk.go b/api/registry/v1/registry_sdk.go index 2c976f747..6246713e7 100644 --- a/api/registry/v1/registry_sdk.go +++ b/api/registry/v1/registry_sdk.go @@ -310,6 +310,7 @@ func (enum *TagStatus) UnmarshalJSON(data []byte) error { return nil } +// Image image type Image struct { // ID the unique ID of the Image ID string `json:"id"` @@ -337,6 +338,7 @@ type Image struct { Tags []string `json:"tags"` } +// ListImagesResponse list images response type ListImagesResponse struct { // Images paginated list of images matching filters Images []*Image `json:"images"` @@ -344,6 +346,7 @@ type ListImagesResponse struct { TotalCount uint32 `json:"total_count"` } +// ListNamespacesResponse list namespaces response type ListNamespacesResponse struct { // Namespaces paginated list of namespaces matching filters Namespaces []*Namespace `json:"namespaces"` @@ -351,6 +354,7 @@ type ListNamespacesResponse struct { TotalCount uint32 `json:"total_count"` } +// ListTagsResponse list tags response type ListTagsResponse struct { // Tags paginated list of tags matching filters Tags []*Tag `json:"tags"` @@ -358,6 +362,7 @@ type ListTagsResponse struct { TotalCount uint32 `json:"total_count"` } +// Namespace namespace type Namespace struct { // ID the unique ID of the namespace ID string `json:"id"` @@ -389,6 +394,7 @@ type Namespace struct { Region scw.Region `json:"region"` } +// Tag tag type Tag struct { // ID the unique ID of the tag ID string `json:"id"`