Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fields order for project identifiers #1909

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions api/baremetal/v1/baremetal_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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")
}
Expand Down
16 changes: 8 additions & 8 deletions api/k8s/v1/k8s_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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")
}
Expand Down
96 changes: 48 additions & 48 deletions api/lb/v1/lb_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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"`
}

Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down
16 changes: 8 additions & 8 deletions api/rdb/v1/rdb_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
}
Expand Down
16 changes: 8 additions & 8 deletions api/registry/v1/registry_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
}
Expand Down
Loading
Loading