From f1cd337e6bcd6c9efca77257e4c7987568e4fb2b Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Thu, 3 Sep 2026 14:11:24 +0000 Subject: [PATCH] feat: update generated APIs --- api/audit_trail/v1alpha1/audit_trail_sdk.go | 44 ++++++- api/instance/v1/instance_sdk.go | 7 ++ api/instance/v2alpha1/instance_sdk.go | 68 ++++++++++- api/key_manager/v1alpha1/key_manager_sdk.go | 59 ++++++++-- .../v1alpha1/serverless_sqldb_sdk.go | 111 ++++++++++++++++++ 5 files changed, 278 insertions(+), 11 deletions(-) diff --git a/api/audit_trail/v1alpha1/audit_trail_sdk.go b/api/audit_trail/v1alpha1/audit_trail_sdk.go index 634ef2f53..0fe82d4de 100644 --- a/api/audit_trail/v1alpha1/audit_trail_sdk.go +++ b/api/audit_trail/v1alpha1/audit_trail_sdk.go @@ -40,6 +40,47 @@ var ( _ = namegenerator.GetRandomName ) +type Action string + +const ( + ActionUnknownAction = Action("unknown_action") + ActionCreate = Action("create") + ActionUpdate = Action("update") + ActionDelete = Action("delete") +) + +func (enum Action) String() string { + if enum == "" { + // return default value if empty + return string(ActionUnknownAction) + } + return string(enum) +} + +func (enum Action) Values() []Action { + return []Action{ + "unknown_action", + "create", + "update", + "delete", + } +} + +func (enum Action) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(`"%s"`, enum)), nil +} + +func (enum *Action) UnmarshalJSON(data []byte) error { + tmp := "" + + if err := json.Unmarshal(data, &tmp); err != nil { + return err + } + + *enum = Action(Action(tmp).String()) + return nil +} + type AlertRuleStatus string const ( @@ -1330,7 +1371,8 @@ type Resource struct { Name *string `json:"name"` - Action *string `json:"action"` + // Action: default value: unknown_action + Action *Action `json:"action"` // Deprecated // Precisely one of SecmSecretInfo, SecmSecretVersionInfo, KubeClusterInfo, KubePoolInfo, KubeNodeInfo, KubeACLInfo, KeymKeyInfo, SecretManagerSecretInfo, SecretManagerVersionInfo, KeyManagerKeyInfo, AccountUserInfo, AccountOrganizationInfo, InstanceServerInfo, AppleSiliconServerInfo, AccountProjectInfo, BaremetalServerInfo, BaremetalSettingInfo, IpamIPInfo, LoadBalancerLBInfo, LoadBalancerIPInfo, LoadBalancerFrontendInfo, LoadBalancerBackendInfo, LoadBalancerRouteInfo, LoadBalancerACLInfo, LoadBalancerCertificateInfo, EdgeServicesPlanInfo, EdgeServicesPipelineInfo, EdgeServicesDNSStageInfo, EdgeServicesTLSStageInfo, EdgeServicesCacheStageInfo, EdgeServicesRouteStageInfo, EdgeServicesRouteRulesInfo, EdgeServicesWafStageInfo, EdgeServicesBackendStageInfo, AccountContractSignatureInfo, VpcSubnetInfo, VpcRouteInfo, VpcPrivateNetworkInfo, AuditTrailExportJobInfo, VpcGwGatewayInfo, VpcGwGatewayNetworkInfo, AppleSiliconRunnerInfo, AuditTrailAlertRuleInfo, VpcConnectorInfo, InstancePrivateNetworkInterfaceInfo, VpcIngressRuleInfo, ObservabilityContactPointInfo, ObservabilityAlertRuleInfo, EdgeServicesVpcEndpointInfo, AuditTrailCustomAlertRuleInfo, ServerlessContainersNamespaceInfo, ServerlessContainersContainerInfo, ServerlessContainersDomainInfo, ServerlessContainersTriggerInfo, ServerlessFunctionsNamespaceInfo, ServerlessFunctionsFunctionInfo, ServerlessFunctionsDomainInfo, ServerlessFunctionsCronInfo, ServerlessFunctionsTriggerInfo must be set. diff --git a/api/instance/v1/instance_sdk.go b/api/instance/v1/instance_sdk.go index fcb194df3..1d23b1a8d 100644 --- a/api/instance/v1/instance_sdk.go +++ b/api/instance/v1/instance_sdk.go @@ -6638,6 +6638,8 @@ func (s *API) DeleteIP(req *DeleteIPRequest, opts ...scw.RequestOption) error { } // ListPrivateNICs: List all private NICs of a specified Instance. +// Some private NICs, such as those in deleting, detaching, or in error state are +// not listed. We strongly recommend migrating to v2alpha1 to retrieve all private NICs. func (s *API) ListPrivateNICs(req *ListPrivateNICsRequest, opts ...scw.RequestOption) (*ListPrivateNICsResponse, error) { var err error @@ -6677,6 +6679,11 @@ func (s *API) ListPrivateNICs(req *ListPrivateNICsRequest, opts ...scw.RequestOp } // CreatePrivateNIC: Create a private NIC connecting an Instance to a Private Network. +// Some private NICs, such as those in deleting, detaching, or in error state are +// not listed in v1. +// Therefore, you may encounter quota limits errors when creating a new private NIC, even if your visible +// count is below the threshold. +// We strongly recommend migrating to v2alpha1 to see all private NICs. func (s *API) CreatePrivateNIC(req *CreatePrivateNICRequest, opts ...scw.RequestOption) (*CreatePrivateNICResponse, error) { var err error diff --git a/api/instance/v2alpha1/instance_sdk.go b/api/instance/v2alpha1/instance_sdk.go index facc01d87..35f7a108d 100644 --- a/api/instance/v2alpha1/instance_sdk.go +++ b/api/instance/v2alpha1/instance_sdk.go @@ -518,6 +518,12 @@ const ( PrivateNetworkInterfaceStatusDetaching = PrivateNetworkInterfaceStatus("detaching") // Attached, detached, or when the associated security-group rules are being updated on the interface. PrivateNetworkInterfaceStatusSyncing = PrivateNetworkInterfaceStatus("syncing") + // Interface is being deleted. + PrivateNetworkInterfaceStatusDeleting = PrivateNetworkInterfaceStatus("deleting") + // Stop the server to fix the issue. + PrivateNetworkInterfaceStatusDetachError = PrivateNetworkInterfaceStatus("detach_error") + // Stop the server to fix the issue. + PrivateNetworkInterfaceStatusDeleteError = PrivateNetworkInterfaceStatus("delete_error") ) func (enum PrivateNetworkInterfaceStatus) String() string { @@ -535,6 +541,9 @@ func (enum PrivateNetworkInterfaceStatus) Values() []PrivateNetworkInterfaceStat "attaching", "detaching", "syncing", + "deleting", + "detach_error", + "delete_error", } } @@ -874,6 +883,12 @@ const ( ServerPrivateNetworkInterfaceStatusDetaching = ServerPrivateNetworkInterfaceStatus("detaching") // The associated security-group rules are being updated on the interface. ServerPrivateNetworkInterfaceStatusSyncing = ServerPrivateNetworkInterfaceStatus("syncing") + // Interface is being deleted. + ServerPrivateNetworkInterfaceStatusDeleting = ServerPrivateNetworkInterfaceStatus("deleting") + // Stop the server to fix the issue. + ServerPrivateNetworkInterfaceStatusDetachError = ServerPrivateNetworkInterfaceStatus("detach_error") + // Stop the server to fix the issue. + ServerPrivateNetworkInterfaceStatusDeleteError = ServerPrivateNetworkInterfaceStatus("delete_error") ) func (enum ServerPrivateNetworkInterfaceStatus) String() string { @@ -891,6 +906,9 @@ func (enum ServerPrivateNetworkInterfaceStatus) Values() []ServerPrivateNetworkI "attaching", "detaching", "syncing", + "deleting", + "detach_error", + "delete_error", } } @@ -2301,11 +2319,11 @@ type DeleteServerRequest struct { // Precisely one of DeleteAllIPs, DeleteIPIDs must be set. DeleteIPIDs *[]string `json:"delete_ip_ids,omitempty"` - // DeleteAllVolumes: whether to delete all volumes attached to the server. + // DeleteAllVolumes: whether to delete all volumes attached to the server. Deletion of SBS volumes is not supported yet. // Precisely one of DeleteAllVolumes, DeleteVolumeIDs must be set. DeleteAllVolumes *bool `json:"delete_all_volumes,omitempty"` - // DeleteVolumeIDs: list of volume IDs to delete. + // DeleteVolumeIDs: list of volume IDs to delete. Deletion of SBS volumes is not supported yet. // Precisely one of DeleteAllVolumes, DeleteVolumeIDs must be set. DeleteVolumeIDs *[]string `json:"delete_volume_ids,omitempty"` @@ -2351,6 +2369,15 @@ type DeleteUserDataRequest struct { Key string `json:"-"` } +// DetachAndDeletePrivateNetworkInterfaceRequest: detach and delete private network interface request. +type DetachAndDeletePrivateNetworkInterfaceRequest struct { + // Zone: zone to target. If none is passed will use default zone from the config. + Zone scw.Zone `json:"-"` + + // PrivateNetworkInterfaceID: ID of the private network interface to detach and delete. + PrivateNetworkInterfaceID string `json:"-"` +} + // DetachServerFileSystemRequest: detach server file system request. type DetachServerFileSystemRequest struct { // Zone: zone to target. If none is passed will use default zone from the config. @@ -4801,6 +4828,7 @@ func (s *API) WaitForPrivateNetworkInterface(req *WaitForPrivateNetworkInterface PrivateNetworkInterfaceStatusAttaching: {}, PrivateNetworkInterfaceStatusDetaching: {}, PrivateNetworkInterfaceStatusSyncing: {}, + PrivateNetworkInterfaceStatusDeleting: {}, } res, err := async.WaitSync(&async.WaitSyncConfig{ @@ -4892,6 +4920,42 @@ func (s *API) DeletePrivateNetworkInterface(req *DeletePrivateNetworkInterfaceRe return nil } +// DetachAndDeletePrivateNetworkInterface: +func (s *API) DetachAndDeletePrivateNetworkInterface(req *DetachAndDeletePrivateNetworkInterfaceRequest, opts ...scw.RequestOption) (*PrivateNetworkInterface, error) { + var err error + + if req.Zone == "" { + defaultZone, _ := s.client.GetDefaultZone() + req.Zone = defaultZone + } + + if fmt.Sprint(req.Zone) == "" { + return nil, errors.New("field Zone cannot be empty in request") + } + + if fmt.Sprint(req.PrivateNetworkInterfaceID) == "" { + return nil, errors.New("field PrivateNetworkInterfaceID cannot be empty in request") + } + + scwReq := &scw.ScalewayRequest{ + Method: "POST", + Path: "/instance/v2alpha1/zones/" + fmt.Sprint(req.Zone) + "/private-network-interfaces/" + fmt.Sprint(req.PrivateNetworkInterfaceID) + "/detach-and-delete", + } + + err = scwReq.SetBody(req) + if err != nil { + return nil, err + } + + var resp PrivateNetworkInterface + + err = s.client.Do(scwReq, &resp, opts...) + if err != nil { + return nil, err + } + return &resp, nil +} + // ListPlacementGroups: List all placement groups. func (s *API) ListPlacementGroups(req *ListPlacementGroupsRequest, opts ...scw.RequestOption) (*ListPlacementGroupsResponse, error) { var err error diff --git a/api/key_manager/v1alpha1/key_manager_sdk.go b/api/key_manager/v1alpha1/key_manager_sdk.go index 1b34a6ff7..de577bb25 100644 --- a/api/key_manager/v1alpha1/key_manager_sdk.go +++ b/api/key_manager/v1alpha1/key_manager_sdk.go @@ -88,8 +88,6 @@ const ( KeyAlgorithmAsymmetricEncryptionRsaOaep3072Sha256 = KeyAlgorithmAsymmetricEncryption("rsa_oaep_3072_sha256") // RSA-OAEP (Optimal Asymmetric Encryption Padding) with a 4096-bit key and SHA-256 hash function. KeyAlgorithmAsymmetricEncryptionRsaOaep4096Sha256 = KeyAlgorithmAsymmetricEncryption("rsa_oaep_4096_sha256") - KeyAlgorithmAsymmetricEncryptionMlKem768 = KeyAlgorithmAsymmetricEncryption("ml_kem_768") - KeyAlgorithmAsymmetricEncryptionMlKem1024 = KeyAlgorithmAsymmetricEncryption("ml_kem_1024") ) func (enum KeyAlgorithmAsymmetricEncryption) String() string { @@ -106,8 +104,6 @@ func (enum KeyAlgorithmAsymmetricEncryption) Values() []KeyAlgorithmAsymmetricEn "rsa_oaep_2048_sha256", "rsa_oaep_3072_sha256", "rsa_oaep_4096_sha256", - "ml_kem_768", - "ml_kem_1024", } } @@ -151,7 +147,8 @@ const ( // ML-DSA (Module-Lattice Digital Signature Algorithm) FIPS 204 post-quantum signature scheme with security category 3. KeyAlgorithmAsymmetricSigningMlDsa65 = KeyAlgorithmAsymmetricSigning("ml_dsa_65") // ML-DSA (Module-Lattice Digital Signature Algorithm) FIPS 204 post-quantum signature scheme with security category 5. - KeyAlgorithmAsymmetricSigningMlDsa87 = KeyAlgorithmAsymmetricSigning("ml_dsa_87") + KeyAlgorithmAsymmetricSigningMlDsa87 = KeyAlgorithmAsymmetricSigning("ml_dsa_87") + KeyAlgorithmAsymmetricSigningEcSecp256k1Sha256 = KeyAlgorithmAsymmetricSigning("ec_secp256k1_sha256") ) func (enum KeyAlgorithmAsymmetricSigning) String() string { @@ -176,6 +173,7 @@ func (enum KeyAlgorithmAsymmetricSigning) Values() []KeyAlgorithmAsymmetricSigni "ml_dsa_44", "ml_dsa_65", "ml_dsa_87", + "ec_secp256k1_sha256", } } @@ -194,6 +192,45 @@ func (enum *KeyAlgorithmAsymmetricSigning) UnmarshalJSON(data []byte) error { return nil } +type KeyAlgorithmKeyEncapsulation string + +const ( + KeyAlgorithmKeyEncapsulationUnknownKeyEncapsulation = KeyAlgorithmKeyEncapsulation("unknown_key_encapsulation") + KeyAlgorithmKeyEncapsulationMlKem768 = KeyAlgorithmKeyEncapsulation("ml_kem_768") + KeyAlgorithmKeyEncapsulationMlKem1024 = KeyAlgorithmKeyEncapsulation("ml_kem_1024") +) + +func (enum KeyAlgorithmKeyEncapsulation) String() string { + if enum == "" { + // return default value if empty + return string(KeyAlgorithmKeyEncapsulationUnknownKeyEncapsulation) + } + return string(enum) +} + +func (enum KeyAlgorithmKeyEncapsulation) Values() []KeyAlgorithmKeyEncapsulation { + return []KeyAlgorithmKeyEncapsulation{ + "unknown_key_encapsulation", + "ml_kem_768", + "ml_kem_1024", + } +} + +func (enum KeyAlgorithmKeyEncapsulation) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(`"%s"`, enum)), nil +} + +func (enum *KeyAlgorithmKeyEncapsulation) UnmarshalJSON(data []byte) error { + tmp := "" + + if err := json.Unmarshal(data, &tmp); err != nil { + return err + } + + *enum = KeyAlgorithmKeyEncapsulation(KeyAlgorithmKeyEncapsulation(tmp).String()) + return nil +} + type KeyAlgorithmSymmetricEncryption string const ( @@ -326,6 +363,7 @@ const ( ListAlgorithmsRequestUsageSymmetricEncryption = ListAlgorithmsRequestUsage("symmetric_encryption") ListAlgorithmsRequestUsageAsymmetricEncryption = ListAlgorithmsRequestUsage("asymmetric_encryption") ListAlgorithmsRequestUsageAsymmetricSigning = ListAlgorithmsRequestUsage("asymmetric_signing") + ListAlgorithmsRequestUsageKeyEncapsulation = ListAlgorithmsRequestUsage("key_encapsulation") ) func (enum ListAlgorithmsRequestUsage) String() string { @@ -342,6 +380,7 @@ func (enum ListAlgorithmsRequestUsage) Values() []ListAlgorithmsRequestUsage { "symmetric_encryption", "asymmetric_encryption", "asymmetric_signing", + "key_encapsulation", } } @@ -459,18 +498,22 @@ type KeyRotationPolicy struct { type KeyUsage struct { // SymmetricEncryption: see the `Key.Algorithm.SymmetricEncryption` enum for a description of values. // Default value: unknown_symmetric_encryption - // Precisely one of SymmetricEncryption, AsymmetricEncryption, AsymmetricSigning must be set. + // Precisely one of SymmetricEncryption, AsymmetricEncryption, AsymmetricSigning, KeyEncapsulation must be set. SymmetricEncryption *KeyAlgorithmSymmetricEncryption `json:"symmetric_encryption,omitempty"` // AsymmetricEncryption: see the `Key.Algorithm.AsymmetricEncryption` enum for a description of values. // Default value: unknown_asymmetric_encryption - // Precisely one of SymmetricEncryption, AsymmetricEncryption, AsymmetricSigning must be set. + // Precisely one of SymmetricEncryption, AsymmetricEncryption, AsymmetricSigning, KeyEncapsulation must be set. AsymmetricEncryption *KeyAlgorithmAsymmetricEncryption `json:"asymmetric_encryption,omitempty"` // AsymmetricSigning: see the `Key.Algorithm.AsymmetricSigning` enum for a description of values. // Default value: unknown_asymmetric_signing - // Precisely one of SymmetricEncryption, AsymmetricEncryption, AsymmetricSigning must be set. + // Precisely one of SymmetricEncryption, AsymmetricEncryption, AsymmetricSigning, KeyEncapsulation must be set. AsymmetricSigning *KeyAlgorithmAsymmetricSigning `json:"asymmetric_signing,omitempty"` + + // KeyEncapsulation: default value: unknown_key_encapsulation + // Precisely one of SymmetricEncryption, AsymmetricEncryption, AsymmetricSigning, KeyEncapsulation must be set. + KeyEncapsulation *KeyAlgorithmKeyEncapsulation `json:"key_encapsulation,omitempty"` } // ListAlgorithmsResponseAlgorithm: list algorithms response algorithm. diff --git a/api/serverless_sqldb/v1alpha1/serverless_sqldb_sdk.go b/api/serverless_sqldb/v1alpha1/serverless_sqldb_sdk.go index b439cc290..054ddcc49 100644 --- a/api/serverless_sqldb/v1alpha1/serverless_sqldb_sdk.go +++ b/api/serverless_sqldb/v1alpha1/serverless_sqldb_sdk.go @@ -12,6 +12,7 @@ import ( "net/http" "net/url" "strings" + "text/template" "time" "github.com/scaleway/scaleway-sdk-go/errors" @@ -249,6 +250,41 @@ type DatabaseBackup struct { // Region: region of the database backup. Region scw.Region `json:"region"` + + // This field is automatically generated, do not edit it + Srn string `json:"srn,omitempty"` +} + +func (m *DatabaseBackup) setSRN(platform string) { + if m.Srn != "" { + // if the field is set server-side, trust the server + return + } + data := struct { + DatabaseBackup + Platform string + }{ + DatabaseBackup: *m, + Platform: platform, + } + + notEmpty := func(a any) (string, error) { + s := fmt.Sprint(a) + if s == "" { + return "", errors.New("value is empty") + } + return s, nil + } + templ := "srn://serverless-db.{{ notempty .Platform }}/regions/{{ notempty .Region }}/backups/{{ notempty .ID }}" + t, err := template.New("srn").Funcs(template.FuncMap{"notempty": notEmpty}).Parse(templ) + if err != nil { + return + } + var out bytes.Buffer + if err := t.Execute(&out, data); err == nil { + m.Srn = out.String() + } + // note: if the error was not nil, we simply don't set the SRN } // Database: database. @@ -292,6 +328,41 @@ type Database struct { // EngineMajorVersion: the major version of the underlying database engine. EngineMajorVersion uint32 `json:"engine_major_version"` + + // This field is automatically generated, do not edit it + Srn string `json:"srn,omitempty"` +} + +func (m *Database) setSRN(platform string) { + if m.Srn != "" { + // if the field is set server-side, trust the server + return + } + data := struct { + Database + Platform string + }{ + Database: *m, + Platform: platform, + } + + notEmpty := func(a any) (string, error) { + s := fmt.Sprint(a) + if s == "" { + return "", errors.New("value is empty") + } + return s, nil + } + templ := "srn://serverless-db.{{ notempty .Platform }}/regions/{{ notempty .Region }}/databases/{{ notempty .ID }}" + t, err := template.New("srn").Funcs(template.FuncMap{"notempty": notEmpty}).Parse(templ) + if err != nil { + return + } + var out bytes.Buffer + if err := t.Execute(&out, data); err == nil { + m.Srn = out.String() + } + // note: if the error was not nil, we simply don't set the SRN } // CreateDatabaseRequest: create database request. @@ -534,6 +605,10 @@ func (s *API) CreateDatabase(req *CreateDatabaseRequest, opts ...scw.RequestOpti if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + resp.setSRN(apiMetadata.Domain) + } return &resp, nil } @@ -565,6 +640,10 @@ func (s *API) GetDatabase(req *GetDatabaseRequest, opts ...scw.RequestOption) (* if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + resp.setSRN(apiMetadata.Domain) + } return &resp, nil } @@ -645,6 +724,10 @@ func (s *API) DeleteDatabase(req *DeleteDatabaseRequest, opts ...scw.RequestOpti if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + resp.setSRN(apiMetadata.Domain) + } return &resp, nil } @@ -691,6 +774,12 @@ func (s *API) ListDatabases(req *ListDatabasesRequest, opts ...scw.RequestOption if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + for _, el := range resp.Databases { + el.setSRN(apiMetadata.Domain) + } + } return &resp, nil } @@ -727,6 +816,10 @@ func (s *API) UpdateDatabase(req *UpdateDatabaseRequest, opts ...scw.RequestOpti if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + resp.setSRN(apiMetadata.Domain) + } return &resp, nil } @@ -763,6 +856,10 @@ func (s *API) RestoreDatabaseFromBackup(req *RestoreDatabaseFromBackupRequest, o if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + resp.setSRN(apiMetadata.Domain) + } return &resp, nil } @@ -794,6 +891,10 @@ func (s *API) GetDatabaseBackup(req *GetDatabaseBackupRequest, opts ...scw.Reque if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + resp.setSRN(apiMetadata.Domain) + } return &resp, nil } @@ -835,6 +936,12 @@ func (s *API) ListDatabaseBackups(req *ListDatabaseBackupsRequest, opts ...scw.R if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + for _, el := range resp.Backups { + el.setSRN(apiMetadata.Domain) + } + } return &resp, nil } @@ -871,5 +978,9 @@ func (s *API) ExportDatabaseBackup(req *ExportDatabaseBackupRequest, opts ...scw if err != nil { return nil, err } + apiMetadata, err := s.client.GetAPIMetadata() + if err == nil { + resp.setSRN(apiMetadata.Domain) + } return &resp, nil }