Skip to content

Commit

Permalink
feat(instance): create CheckQuotasOrganizationBlockMigration endpoint (
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Nov 29, 2024
1 parent ade887d commit 8d738b4
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions api/instance/v1/instance_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,14 @@ type AttachServerVolumeResponse struct {
Server *Server `json:"server"`
}

// CheckBlockMigrationOrganizationQuotasRequest: check block migration organization quotas request.
type CheckBlockMigrationOrganizationQuotasRequest struct {
// Zone: zone to target. If none is passed will use default zone from the config.
Zone scw.Zone `json:"-"`

Organization string `json:"organization,omitempty"`
}

// CreateIPRequest: create ip request.
type CreateIPRequest struct {
// Zone: zone to target. If none is passed will use default zone from the config.
Expand Down Expand Up @@ -6641,3 +6649,38 @@ func (s *API) ApplyBlockMigration(req *ApplyBlockMigrationRequest, opts ...scw.R
}
return nil
}

// CheckBlockMigrationOrganizationQuotas:
func (s *API) CheckBlockMigrationOrganizationQuotas(req *CheckBlockMigrationOrganizationQuotasRequest, opts ...scw.RequestOption) error {
var err error

if req.Zone == "" {
defaultZone, _ := s.client.GetDefaultZone()
req.Zone = defaultZone
}

if req.Organization == "" {
defaultOrganization, _ := s.client.GetDefaultOrganizationID()
req.Organization = defaultOrganization
}

if fmt.Sprint(req.Zone) == "" {
return errors.New("field Zone cannot be empty in request")
}

scwReq := &scw.ScalewayRequest{
Method: "POST",
Path: "/instance/v1/zones/" + fmt.Sprint(req.Zone) + "/block-migration/check-organization-quotas",
}

err = scwReq.SetBody(req)
if err != nil {
return err
}

err = s.client.Do(scwReq, nil, opts...)
if err != nil {
return err
}
return nil
}

0 comments on commit 8d738b4

Please sign in to comment.