diff --git a/api/account/v2alpha1/account_sdk.go b/api/account/v2alpha1/account_sdk.go index d2a3de2d8..6e20dda99 100644 --- a/api/account/v2alpha1/account_sdk.go +++ b/api/account/v2alpha1/account_sdk.go @@ -279,7 +279,7 @@ func (s *API) GetSSHKey(req *GetSSHKeyRequest, opts ...scw.RequestOption) (*SSHK type UpdateSSHKeyRequest struct { SSHKeyID string `json:"-"` - + // Name: name of the SSH key Name *string `json:"name"` } diff --git a/api/instance/v1/instance_sdk.go b/api/instance/v1/instance_sdk.go index 31bf173c3..c6e40ccf9 100644 --- a/api/instance/v1/instance_sdk.go +++ b/api/instance/v1/instance_sdk.go @@ -1672,7 +1672,7 @@ func (s *API) DeleteServer(req *DeleteServerRequest, opts ...scw.RequestOption) type GetServerRequest struct { Zone scw.Zone `json:"-"` - + // ServerID: UUID of the server you want to get ServerID string `json:"-"` } @@ -2138,7 +2138,7 @@ func (r *ListImagesResponse) UnsafeAppend(res interface{}) (uint32, error) { type GetImageRequest struct { Zone scw.Zone `json:"-"` - + // ImageID: UUID of the image you want to get ImageID string `json:"-"` } @@ -2316,7 +2316,7 @@ func (s *API) setImage(req *SetImageRequest, opts ...scw.RequestOption) (*setIma type DeleteImageRequest struct { Zone scw.Zone `json:"-"` - + // ImageID: UUID of the image you want to delete ImageID string `json:"-"` } @@ -2477,7 +2477,7 @@ func (s *API) CreateSnapshot(req *CreateSnapshotRequest, opts ...scw.RequestOpti type GetSnapshotRequest struct { Zone scw.Zone `json:"-"` - + // SnapshotID: UUID of the snapshot you want to get SnapshotID string `json:"-"` } @@ -2587,7 +2587,7 @@ func (s *API) setSnapshot(req *SetSnapshotRequest, opts ...scw.RequestOption) (* type DeleteSnapshotRequest struct { Zone scw.Zone `json:"-"` - + // SnapshotID: UUID of the snapshot you want to delete SnapshotID string `json:"-"` } @@ -2762,7 +2762,7 @@ func (s *API) CreateVolume(req *CreateVolumeRequest, opts ...scw.RequestOption) type GetVolumeRequest struct { Zone scw.Zone `json:"-"` - + // VolumeID: UUID of the volume you want to get VolumeID string `json:"-"` } @@ -2851,7 +2851,7 @@ func (s *API) UpdateVolume(req *UpdateVolumeRequest, opts ...scw.RequestOption) type DeleteVolumeRequest struct { Zone scw.Zone `json:"-"` - + // VolumeID: UUID of the volume you want to delete VolumeID string `json:"-"` } @@ -3032,7 +3032,7 @@ func (s *API) CreateSecurityGroup(req *CreateSecurityGroupRequest, opts ...scw.R type GetSecurityGroupRequest struct { Zone scw.Zone `json:"-"` - + // SecurityGroupID: UUID of the security group you want to get SecurityGroupID string `json:"-"` } @@ -3072,7 +3072,7 @@ func (s *API) GetSecurityGroup(req *GetSecurityGroupRequest, opts ...scw.Request type DeleteSecurityGroupRequest struct { Zone scw.Zone `json:"-"` - + // SecurityGroupID: UUID of the security group you want to delete SecurityGroupID string `json:"-"` } @@ -3620,7 +3620,7 @@ func (s *API) CreatePlacementGroup(req *CreatePlacementGroupRequest, opts ...scw type GetPlacementGroupRequest struct { Zone scw.Zone `json:"-"` - + // PlacementGroupID: UUID of the placement group you want to get PlacementGroupID string `json:"-"` } @@ -3777,7 +3777,7 @@ func (s *API) UpdatePlacementGroup(req *UpdatePlacementGroupRequest, opts ...scw type DeletePlacementGroupRequest struct { Zone scw.Zone `json:"-"` - + // PlacementGroupID: UUID of the placement group you want to delete PlacementGroupID string `json:"-"` } diff --git a/api/rdb/v1/rdb_sdk.go b/api/rdb/v1/rdb_sdk.go index 50e549a78..aec0f8aad 100644 --- a/api/rdb/v1/rdb_sdk.go +++ b/api/rdb/v1/rdb_sdk.go @@ -897,7 +897,9 @@ type ListInstanceACLRulesResponse struct { TotalCount uint32 `json:"total_count"` } +// ListInstanceLogsResponse: list instance logs response type ListInstanceLogsResponse struct { + // InstanceLogs: available logs in a given instance InstanceLogs []*InstanceLog `json:"instance_logs"` } @@ -1339,7 +1341,7 @@ func (s *API) RestoreDatabaseBackup(req *RestoreDatabaseBackupRequest, opts ...s type ExportDatabaseBackupRequest struct { Region scw.Region `json:"-"` - + // DatabaseBackupID: UUID of the database backup you want to export DatabaseBackupID string `json:"-"` } @@ -1494,12 +1496,12 @@ func (r *ListDatabaseEnginesResponse) UnsafeAppend(res interface{}) (uint32, err type UpgradeInstanceRequest struct { Region scw.Region `json:"-"` - + // InstanceID: UUID of the instance you want to upgrade InstanceID string `json:"-"` - + // NodeType: node type of the instance you want to upgrade to // Precisely one of EnableHa, NodeType must be set. NodeType *string `json:"node_type,omitempty"` - + // EnableHa: set to true to enable high availability on your instance // Precisely one of EnableHa, NodeType must be set. EnableHa *bool `json:"enable_ha,omitempty"` } @@ -1900,9 +1902,9 @@ func (s *API) PrepareInstanceLogs(req *PrepareInstanceLogsRequest, opts ...scw.R type ListInstanceLogsRequest struct { Region scw.Region `json:"-"` - + // InstanceID: UUID of the instance you want logs of InstanceID string `json:"-"` - // OrderBy: + // OrderBy: criteria to use when ordering instance logs listing // // Default value: created_at_asc OrderBy ListInstanceLogsRequestOrderBy `json:"-"` @@ -1944,6 +1946,44 @@ func (s *API) ListInstanceLogs(req *ListInstanceLogsRequest, opts ...scw.Request return &resp, nil } +type GetInstanceLogRequest struct { + Region scw.Region `json:"-"` + // InstanceLogID: UUID of the instance_log you want + InstanceLogID string `json:"-"` +} + +// GetInstanceLog: get specific logs of a given instance +func (s *API) GetInstanceLog(req *GetInstanceLogRequest, opts ...scw.RequestOption) (*InstanceLog, error) { + var err error + + if req.Region == "" { + defaultRegion, _ := s.client.GetDefaultRegion() + req.Region = defaultRegion + } + + if fmt.Sprint(req.Region) == "" { + return nil, errors.New("field Region cannot be empty in request") + } + + if fmt.Sprint(req.InstanceLogID) == "" { + return nil, errors.New("field InstanceLogID cannot be empty in request") + } + + scwReq := &scw.ScalewayRequest{ + Method: "GET", + Path: "/rdb/v1/regions/" + fmt.Sprint(req.Region) + "/logs/" + fmt.Sprint(req.InstanceLogID) + "", + Headers: http.Header{}, + } + + var resp InstanceLog + + err = s.client.Do(scwReq, &resp, opts...) + if err != nil { + return nil, err + } + return &resp, nil +} + type GetInstanceMetricsRequest struct { Region scw.Region `json:"-"` // InstanceID: UUID of the instance diff --git a/api/test/v1/test_sdk.go b/api/test/v1/test_sdk.go index 0b9ba3f55..a96e279bc 100644 --- a/api/test/v1/test_sdk.go +++ b/api/test/v1/test_sdk.go @@ -354,7 +354,7 @@ func (r *ListHumansResponse) UnsafeAppend(res interface{}) (uint32, error) { type GetHumanRequest struct { Region scw.Region `json:"-"` - + // HumanID: UUID of the human you want to get HumanID string `json:"-"` } @@ -467,7 +467,7 @@ func (s *API) CreateHuman(req *CreateHumanRequest, opts ...scw.RequestOption) (* type UpdateHumanRequest struct { Region scw.Region `json:"-"` - + // HumanID: UUID of the human you want to update HumanID string `json:"-"` Height *float64 `json:"height"` @@ -532,7 +532,7 @@ func (s *API) UpdateHuman(req *UpdateHumanRequest, opts ...scw.RequestOption) (* type DeleteHumanRequest struct { Region scw.Region `json:"-"` - + // HumanID: UUID of the human you want to delete HumanID string `json:"-"` } @@ -572,7 +572,7 @@ func (s *API) DeleteHuman(req *DeleteHumanRequest, opts ...scw.RequestOption) (* type RunHumanRequest struct { Region scw.Region `json:"-"` - + // HumanID: UUID of the human you want to make run HumanID string `json:"-"` } @@ -617,7 +617,7 @@ func (s *API) RunHuman(req *RunHumanRequest, opts ...scw.RequestOption) (*Human, type SmokeHumanRequest struct { Region scw.Region `json:"-"` - + // HumanID: UUID of the human you want to make smoking HumanID string `json:"-"` }