From 2ec59899f287f19387ae6f7436f23ecb7de4d2ca Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Fri, 3 Nov 2023 09:24:02 +0000 Subject: [PATCH] feat: update generated APIs --- api/baremetal/v1/baremetal_sdk.go | 16 +++--- api/k8s/v1/k8s_sdk.go | 16 +++--- api/lb/v1/lb_sdk.go | 96 +++++++++++++++---------------- api/rdb/v1/rdb_sdk.go | 16 +++--- api/registry/v1/registry_sdk.go | 16 +++--- api/test/v1/test_sdk.go | 16 +++--- 6 files changed, 88 insertions(+), 88 deletions(-) diff --git a/api/baremetal/v1/baremetal_sdk.go b/api/baremetal/v1/baremetal_sdk.go index 9ea1eafaf..f25bdb4dc 100644 --- a/api/baremetal/v1/baremetal_sdk.go +++ b/api/baremetal/v1/baremetal_sdk.go @@ -996,11 +996,11 @@ type CreateServerRequest struct { OfferID string `json:"offer_id"` // Deprecated: OrganizationID: organization ID with which the server will be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: project ID with which the server will be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // Name: name of the server (≠hostname). @@ -1714,16 +1714,16 @@ func (s *API) CreateServer(req *CreateServerRequest, opts ...scw.RequestOption) req.Zone = defaultZone } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if fmt.Sprint(req.Zone) == "" { return nil, errors.New("field Zone cannot be empty in request") } diff --git a/api/k8s/v1/k8s_sdk.go b/api/k8s/v1/k8s_sdk.go index d37b13080..6698ef2c5 100644 --- a/api/k8s/v1/k8s_sdk.go +++ b/api/k8s/v1/k8s_sdk.go @@ -1143,11 +1143,11 @@ type CreateClusterRequest struct { Region scw.Region `json:"-"` // Deprecated: OrganizationID: organization ID in which the cluster will be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: project ID in which the cluster will be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // Type: type of the cluster (possible values are kapsule, multicloud, kapsule-dedicated-8, kapsule-dedicated-16). @@ -1868,16 +1868,16 @@ func (s *API) CreateCluster(req *CreateClusterRequest, opts ...scw.RequestOption req.Region = defaultRegion } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if req.Name == "" { req.Name = namegenerator.GetRandomName("k8s") } diff --git a/api/lb/v1/lb_sdk.go b/api/lb/v1/lb_sdk.go index 67fba0096..78816a0d0 100644 --- a/api/lb/v1/lb_sdk.go +++ b/api/lb/v1/lb_sdk.go @@ -1834,11 +1834,11 @@ type CreateIPRequest struct { Region scw.Region `json:"-"` // Deprecated: OrganizationID: organization ID of the Organization where the IP address should be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: project ID of the Project where the IP address should be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // Reverse: reverse DNS (domain name) for the IP address. @@ -1851,11 +1851,11 @@ type CreateLBRequest struct { Region scw.Region `json:"-"` // Deprecated: OrganizationID: scaleway Organization to create the Load Balancer in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: scaleway Project to create the Load Balancer in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // Name: name for the Load Balancer. @@ -1913,11 +1913,11 @@ type CreateSubscriberRequest struct { WebhookConfig *SubscriberWebhookConfig `json:"webhook_config,omitempty"` // Deprecated: OrganizationID: organization ID to create the subscriber in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: project ID to create the subscriber in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` } @@ -3332,11 +3332,11 @@ type ZonedAPICreateIPRequest struct { Zone scw.Zone `json:"-"` // Deprecated: OrganizationID: organization ID of the Organization where the IP address should be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: project ID of the Project where the IP address should be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // Reverse: reverse DNS (domain name) for the IP address. @@ -3349,11 +3349,11 @@ type ZonedAPICreateLBRequest struct { Zone scw.Zone `json:"-"` // Deprecated: OrganizationID: scaleway Organization to create the Load Balancer in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: scaleway Project to create the Load Balancer in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // Name: name for the Load Balancer. @@ -3411,11 +3411,11 @@ type ZonedAPICreateSubscriberRequest struct { WebhookConfig *SubscriberWebhookConfig `json:"webhook_config,omitempty"` // Deprecated: OrganizationID: organization ID to create the subscriber in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: project ID to create the subscriber in. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` } @@ -4308,16 +4308,16 @@ func (s *ZonedAPI) CreateLB(req *ZonedAPICreateLBRequest, opts ...scw.RequestOpt req.Zone = defaultZone } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if req.Name == "" { req.Name = namegenerator.GetRandomName("lb") } @@ -4530,16 +4530,16 @@ func (s *ZonedAPI) CreateIP(req *ZonedAPICreateIPRequest, opts ...scw.RequestOpt req.Zone = defaultZone } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if fmt.Sprint(req.Zone) == "" { return nil, errors.New("field Zone cannot be empty in request") } @@ -5845,16 +5845,16 @@ func (s *ZonedAPI) CreateSubscriber(req *ZonedAPICreateSubscriberRequest, opts . req.Zone = defaultZone } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if fmt.Sprint(req.Zone) == "" { return nil, errors.New("field Zone cannot be empty in request") } @@ -6267,16 +6267,16 @@ func (s *API) CreateLB(req *CreateLBRequest, opts ...scw.RequestOption) (*LB, er req.Region = defaultRegion } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if req.Name == "" { req.Name = namegenerator.GetRandomName("lb") } @@ -6489,16 +6489,16 @@ func (s *API) CreateIP(req *CreateIPRequest, opts ...scw.RequestOption) (*IP, er req.Region = defaultRegion } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if fmt.Sprint(req.Region) == "" { return nil, errors.New("field Region cannot be empty in request") } @@ -7768,16 +7768,16 @@ func (s *API) CreateSubscriber(req *CreateSubscriberRequest, opts ...scw.Request req.Region = defaultRegion } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if fmt.Sprint(req.Region) == "" { return nil, errors.New("field Region cannot be empty in request") } diff --git a/api/rdb/v1/rdb_sdk.go b/api/rdb/v1/rdb_sdk.go index 926c0b5a2..a3e846207 100644 --- a/api/rdb/v1/rdb_sdk.go +++ b/api/rdb/v1/rdb_sdk.go @@ -1502,11 +1502,11 @@ type CreateInstanceRequest struct { Region scw.Region `json:"-"` // Deprecated: OrganizationID: please use project_id instead. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: the Project ID on which the Database Instance will be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // Name: name of the Database Instance. @@ -3009,16 +3009,16 @@ func (s *API) CreateInstance(req *CreateInstanceRequest, opts ...scw.RequestOpti req.Region = defaultRegion } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if req.Name == "" { req.Name = namegenerator.GetRandomName("ins") } diff --git a/api/registry/v1/registry_sdk.go b/api/registry/v1/registry_sdk.go index 7d5a973f2..82bfce435 100644 --- a/api/registry/v1/registry_sdk.go +++ b/api/registry/v1/registry_sdk.go @@ -386,11 +386,11 @@ type CreateNamespaceRequest struct { Description string `json:"description"` // Deprecated: OrganizationID: namespace owner (deprecated). - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` // ProjectID: project ID on which the namespace will be created. - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` // IsPublic: defines whether or not namespace is public. @@ -737,16 +737,16 @@ func (s *API) CreateNamespace(req *CreateNamespaceRequest, opts ...scw.RequestOp req.Region = defaultRegion } - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + if req.Name == "" { req.Name = namegenerator.GetRandomName("ns") } diff --git a/api/test/v1/test_sdk.go b/api/test/v1/test_sdk.go index 6b9492d0f..cc180966d 100644 --- a/api/test/v1/test_sdk.go +++ b/api/test/v1/test_sdk.go @@ -214,12 +214,12 @@ type CreateHumanRequest struct { EyesColor EyeColors `json:"eyes_color"` // Deprecated - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. OrganizationID *string `json:"organization_id,omitempty"` Name string `json:"name"` - // Precisely one of OrganizationID, ProjectID must be set. + // Precisely one of ProjectID, OrganizationID must be set. ProjectID *string `json:"project_id,omitempty"` } @@ -419,16 +419,16 @@ func (s *API) GetHuman(req *GetHumanRequest, opts ...scw.RequestOption) (*Human, func (s *API) CreateHuman(req *CreateHumanRequest, opts ...scw.RequestOption) (*Human, error) { var err error - defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { - req.OrganizationID = &defaultOrganizationID - } - defaultProjectID, exist := s.client.GetDefaultProjectID() - if exist && req.OrganizationID == nil && req.ProjectID == nil { + if exist && req.ProjectID == nil && req.OrganizationID == nil { req.ProjectID = &defaultProjectID } + defaultOrganizationID, exist := s.client.GetDefaultOrganizationID() + if exist && req.ProjectID == nil && req.OrganizationID == nil { + req.OrganizationID = &defaultOrganizationID + } + scwReq := &scw.ScalewayRequest{ Method: "POST", Path: "/test/v1/humans",