diff --git a/.gitignore b/.gitignore index 10c4266b..35e81254 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,3 @@ vendir.lock.yml .craig CLAUDE.md .claude -ROADMAP.md diff --git a/README.md b/README.md index 3b9aced2..4747203b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,9 @@ machine-controller-manager-provider-stackit/ │ ├── provider/ │ │ ├── core.go # Core provider implementation │ │ ├── provider.go # Driver interface implementation -│ │ ├── stackit_client.go # STACKIT API client +│ │ ├── stackit_client.go # STACKIT client interface +│ │ ├── sdk_client.go # STACKIT SDK wrapper implementation +│ │ ├── helpers.go # SDK type conversion utilities │ │ ├── apis/ │ │ │ ├── provider_spec.go # ProviderSpec CRD definitions │ │ │ └── validation/ # Field validation logic @@ -97,6 +99,24 @@ kubectl apply -f samples/machine-class.yaml kubectl apply -f samples/machine.yaml ``` +## STACKIT SDK Integration + +This provider uses the official [STACKIT Go SDK](https://github.com/stackitcloud/stackit-sdk-go) for all interactions with the STACKIT IaaS API. The SDK provides type-safe API access, built-in authentication handling, and is officially maintained by STACKIT. + +The SDK client is stateless and supports different credentials per MachineClass, allowing multi-tenancy scenarios where different machine pools use different STACKIT projects. + +### Authentication & Credentials + +The provider requires STACKIT credentials to be provided via a Kubernetes Secret. The Secret must contain the following fields: + +| Field | Required | Description | +|-------|----------|-------------| +| `projectId` | Yes | STACKIT project UUID | +| `stackitToken` | Yes | STACKIT API authentication token | +| `region` | Yes | STACKIT region (e.g., `eu01-1`, `eu01-2`) | +| `userData` | No | Default cloud-init user data (can be overridden in ProviderSpec) | +| `networkId` | No | Default network UUID (can be overridden in ProviderSpec) | + ## Configuration Reference ### ProviderSpec Fields @@ -145,11 +165,25 @@ just start ## References +### Machine Controller Manager - [Machine Controller Manager](https://github.com/gardener/machine-controller-manager) - Core MCM project - [MCM Provider Development Guide](https://github.com/gardener/machine-controller-manager/blob/master/docs/development/cp_support_new.md) - Guidelines followed to build this provider - [MCM Sample Provider](https://github.com/gardener/machine-controller-manager-provider-sampleprovider) - Original template used as starting point - [MCM Driver Interface](https://github.com/gardener/machine-controller-manager/blob/master/pkg/util/provider/driver/driver.go) - Provider contract interface + +### STACKIT SDK +- [STACKIT SDK Go](https://github.com/stackitcloud/stackit-sdk-go) - Official STACKIT Go SDK +- [IaaS Service Package](https://github.com/stackitcloud/stackit-sdk-go/tree/main/services/iaas) - IaaS service API documentation +- [SDK Core Package](https://github.com/stackitcloud/stackit-sdk-go/tree/main/core) - Core SDK configuration and authentication +- [SDK Examples](https://github.com/stackitcloud/stackit-sdk-go/tree/main/examples) - Code examples and usage patterns +- [SDK Releases](https://github.com/stackitcloud/stackit-sdk-go/releases) - Release notes and changelog + +### STACKIT Platform - [STACKIT Documentation](https://docs.stackit.cloud/) - STACKIT cloud platform documentation +- [STACKIT Portal](https://portal.stackit.cloud/) - STACKIT management console +- [Service Accounts](https://docs.stackit.cloud/stackit/en/service-accounts-134415819.html) - Creating and managing service accounts +- [Service Account Keys](https://docs.stackit.cloud/stackit/en/usage-of-the-service-account-keys-in-stackit-175112464.html) - API authentication setup +- [IaaS API Documentation](https://docs.stackit.cloud/) - STACKIT IaaS REST API reference ## License diff --git a/config/overlays/e2e/kustomization.yaml b/config/overlays/e2e/kustomization.yaml index 1f50fcd3..0a6d400a 100644 --- a/config/overlays/e2e/kustomization.yaml +++ b/config/overlays/e2e/kustomization.yaml @@ -4,8 +4,10 @@ kind: Kustomization resources: - namespace.yaml - ../../default + # TODO: replace ref with 'main' once changes merged upstream - https://github.com/stackit-controllers-k8s/stackit-api-mockservers//config/apis/iaas?ref=main + patches: # Patch MCM deployment to machine-controller-manager namespace - target: diff --git a/go.mod b/go.mod index 745c460e..2da38c24 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,8 @@ require ( github.com/onsi/ginkgo/v2 v2.27.2 github.com/onsi/gomega v1.38.2 github.com/spf13/pflag v1.0.5 + github.com/stackitcloud/stackit-sdk-go/core v0.18.0 + github.com/stackitcloud/stackit-sdk-go/services/iaas v1.0.0 k8s.io/api v0.0.0-20190918155943-95b840bb6a1f k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655 k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090 @@ -23,11 +25,13 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d // indirect + github.com/golang-jwt/jwt/v5 v5.3.0 // indirect github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/gofuzz v1.0.0 // indirect github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/googleapis/gnostic v0.2.0 // indirect github.com/hashicorp/golang-lru v0.5.1 // indirect github.com/imdario/mergo v0.3.5 // indirect diff --git a/go.sum b/go.sum index 257356d6..64efa0b8 100644 --- a/go.sum +++ b/go.sum @@ -80,6 +80,8 @@ github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I= github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= +github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7 h1:u4bArs140e9+AfE52mFHOXVFnOSBJBRlzTHrOPLOIhE= @@ -115,6 +117,8 @@ github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g= @@ -220,6 +224,10 @@ github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzu github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stackitcloud/stackit-sdk-go/core v0.18.0 h1:+4v8sjQpQXPihO3crgTp0Kz/XRIi5p7oKV28dw6jsEQ= +github.com/stackitcloud/stackit-sdk-go/core v0.18.0/go.mod h1:fqto7M82ynGhEnpZU6VkQKYWYoFG5goC076JWXTUPRQ= +github.com/stackitcloud/stackit-sdk-go/services/iaas v1.0.0 h1:qLMpd5whPMLnaLEdFQjK51q/o9V6eMFMORBDSsyGyNI= +github.com/stackitcloud/stackit-sdk-go/services/iaas v1.0.0/go.mod h1:854gnLR92NvAbJAA1xZEumrtNh1DoBP1FXTMvhwYA6w= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= diff --git a/pkg/provider/apis/validation/validation.go b/pkg/provider/apis/validation/validation.go index a6452f43..5d15c2b2 100644 --- a/pkg/provider/apis/validation/validation.go +++ b/pkg/provider/apis/validation/validation.go @@ -28,6 +28,10 @@ var emailRegex = regexp.MustCompile(`^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z] // Pattern: lowercase letter(s) followed by digits, dot, then more digits (e.g., c2i.2, m2i.8, g1a.8) var machineTypeRegex = regexp.MustCompile(`^[a-z]+\d+[a-z]*\.\d+[a-z]*(\.[a-z]+\d+)*$`) +// regionRegex is a regex pattern for validating STACKIT region format +// Pattern: lowercase letters/digits followed by digits, dash, then digit(s) (e.g., eu01-1, eu01-2) +var regionRegex = regexp.MustCompile(`^[a-z0-9]+-\d+$`) + // labelKeyRegex validates Kubernetes label keys (must start/end with alphanumeric, can contain -, _, .) // Maximum length: 63 characters var labelKeyRegex = regexp.MustCompile(`^[a-zA-Z0-9]([-a-zA-Z0-9_.]*[a-zA-Z0-9])?$`) @@ -63,6 +67,16 @@ func ValidateProviderSpecNSecret(spec *api.ProviderSpec, secrets *corev1.Secret) errors = append(errors, fmt.Errorf("secret 'stackitToken' cannot be empty")) } + // Validate region (required for SDK) + region, ok := secrets.Data["region"] + if !ok { + errors = append(errors, fmt.Errorf("secret must contain 'region' field")) + } else if len(region) == 0 { + errors = append(errors, fmt.Errorf("secret 'region' cannot be empty")) + } else if !isValidRegion(string(region)) { + errors = append(errors, fmt.Errorf("secret 'region' has invalid format (expected format: eu01-1, eu01-2, etc.)")) + } + // Validate ProviderSpec if spec.MachineType == "" { errors = append(errors, fmt.Errorf("providerSpec.machineType is required")) @@ -261,3 +275,8 @@ func isValidEmail(s string) bool { func isValidMachineType(s string) bool { return machineTypeRegex.MatchString(s) } + +// isValidRegion checks if a string matches the STACKIT region format +func isValidRegion(s string) bool { + return regionRegex.MatchString(s) +} diff --git a/pkg/provider/apis/validation/validation_core_labels_test.go b/pkg/provider/apis/validation/validation_core_labels_test.go index be4fe4c3..ae9852e4 100644 --- a/pkg/provider/apis/validation/validation_core_labels_test.go +++ b/pkg/provider/apis/validation/validation_core_labels_test.go @@ -28,6 +28,7 @@ var _ = Describe("ValidateProviderSpecNSecret", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token"), + "region": []byte("eu01-1"), }, } }) diff --git a/pkg/provider/apis/validation/validation_fields_test.go b/pkg/provider/apis/validation/validation_fields_test.go index 97baba95..75ca8685 100644 --- a/pkg/provider/apis/validation/validation_fields_test.go +++ b/pkg/provider/apis/validation/validation_fields_test.go @@ -28,6 +28,7 @@ var _ = Describe("ValidateProviderSpecNSecret", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token"), + "region": []byte("eu01-1"), }, } }) diff --git a/pkg/provider/apis/validation/validation_networking_test.go b/pkg/provider/apis/validation/validation_networking_test.go index f3c37d4f..6069c82d 100644 --- a/pkg/provider/apis/validation/validation_networking_test.go +++ b/pkg/provider/apis/validation/validation_networking_test.go @@ -28,6 +28,7 @@ var _ = Describe("ValidateProviderSpecNSecret", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token"), + "region": []byte("eu01-1"), }, } }) diff --git a/pkg/provider/apis/validation/validation_secgroup_test.go b/pkg/provider/apis/validation/validation_secgroup_test.go index ebceb8a2..a7acdd9d 100644 --- a/pkg/provider/apis/validation/validation_secgroup_test.go +++ b/pkg/provider/apis/validation/validation_secgroup_test.go @@ -28,6 +28,7 @@ var _ = Describe("ValidateProviderSpecNSecret", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token"), + "region": []byte("eu01-1"), }, } }) diff --git a/pkg/provider/apis/validation/validation_secret_test.go b/pkg/provider/apis/validation/validation_secret_test.go index 88e5b0e1..2bc4d20f 100644 --- a/pkg/provider/apis/validation/validation_secret_test.go +++ b/pkg/provider/apis/validation/validation_secret_test.go @@ -28,6 +28,7 @@ var _ = Describe("ValidateProviderSpecNSecret", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token"), + "region": []byte("eu01-1"), }, } }) diff --git a/pkg/provider/apis/validation/validation_volumes_test.go b/pkg/provider/apis/validation/validation_volumes_test.go index a21f5254..2de23419 100644 --- a/pkg/provider/apis/validation/validation_volumes_test.go +++ b/pkg/provider/apis/validation/validation_volumes_test.go @@ -28,6 +28,7 @@ var _ = Describe("ValidateProviderSpecNSecret", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token"), + "region": []byte("eu01-1"), }, } }) diff --git a/pkg/provider/core.go b/pkg/provider/core.go index b7048a89..a8ce7604 100644 --- a/pkg/provider/core.go +++ b/pkg/provider/core.go @@ -51,6 +51,7 @@ func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineR // Extract credentials from Secret projectID := string(req.Secret.Data["projectId"]) token := string(req.Secret.Data["stackitToken"]) + region := string(req.Secret.Data["region"]) // Build labels: merge ProviderSpec labels with MCM-specific labels labels := make(map[string]string) @@ -73,12 +74,20 @@ func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineR Labels: labels, } - // Add networking configuration if specified + // Add networking configuration (required in v2 API) + // If not specified in ProviderSpec, try to use networkId from Secret, or use empty if providerSpec.Networking != nil { createReq.Networking = &ServerNetworkingRequest{ NetworkID: providerSpec.Networking.NetworkID, NICIDs: providerSpec.Networking.NICIDs, } + } else { + // v2 API requires networking field - use networkId from Secret if available + // This allows tests/deployments to specify a default network without modifying each MachineClass + networkID := string(req.Secret.Data["networkId"]) + createReq.Networking = &ServerNetworkingRequest{ + NetworkID: networkID, // Can be empty string if not in Secret + } } // Add security groups if specified @@ -155,7 +164,7 @@ func (p *Provider) CreateMachine(ctx context.Context, req *driver.CreateMachineR } // Call STACKIT API to create server - server, err := p.client.CreateServer(ctx, token, projectID, createReq) + server, err := p.client.CreateServer(ctx, token, projectID, region, createReq) if err != nil { klog.Errorf("Failed to create server for machine %q: %v", req.Machine.Name, err) return nil, status.Error(codes.Internal, fmt.Sprintf("failed to create server: %v", err)) @@ -196,6 +205,9 @@ func (p *Provider) DeleteMachine(ctx context.Context, req *driver.DeleteMachineR // Extract token from Secret for authentication token := string(req.Secret.Data["stackitToken"]) + // Extract region from Secret + region := string(req.Secret.Data["region"]) + // Parse ProviderID to extract projectID and serverID projectID, serverID, err := parseProviderID(req.Machine.Spec.ProviderID) if err != nil { @@ -203,7 +215,7 @@ func (p *Provider) DeleteMachine(ctx context.Context, req *driver.DeleteMachineR } // Call STACKIT API to delete server - err = p.client.DeleteServer(ctx, token, projectID, serverID) + err = p.client.DeleteServer(ctx, token, projectID, region, serverID) if err != nil { // Check if server was not found (404) - this is OK for idempotency if errors.Is(err, ErrServerNotFound) { @@ -249,6 +261,9 @@ func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineS // Extract token from Secret for authentication token := string(req.Secret.Data["stackitToken"]) + // Extract region from Secret + region := string(req.Secret.Data["region"]) + // Parse ProviderID to extract projectID and serverID // Expected format: stackit:/// projectID, serverID, err := parseProviderID(req.Machine.Spec.ProviderID) @@ -257,7 +272,7 @@ func (p *Provider) GetMachineStatus(ctx context.Context, req *driver.GetMachineS } // Call STACKIT API to get server status - server, err := p.client.GetServer(ctx, token, projectID, serverID) + server, err := p.client.GetServer(ctx, token, projectID, region, serverID) if err != nil { // Check if server was not found (404) if errors.Is(err, ErrServerNotFound) { @@ -296,9 +311,10 @@ func (p *Provider) ListMachines(ctx context.Context, req *driver.ListMachinesReq // Extract credentials from Secret projectID := string(req.Secret.Data["projectId"]) token := string(req.Secret.Data["stackitToken"]) + region := string(req.Secret.Data["region"]) // Call STACKIT API to list all servers - servers, err := p.client.ListServers(ctx, token, projectID) + servers, err := p.client.ListServers(ctx, token, projectID, region) if err != nil { klog.Errorf("Failed to list servers for MachineClass %q: %v", req.MachineClass.Name, err) return nil, status.Error(codes.Internal, fmt.Sprintf("failed to list servers: %v", err)) diff --git a/pkg/provider/core_create_machine_basic_test.go b/pkg/provider/core_create_machine_basic_test.go index 18869f27..de532324 100644 --- a/pkg/provider/core_create_machine_basic_test.go +++ b/pkg/provider/core_create_machine_basic_test.go @@ -38,11 +38,13 @@ var _ = Describe("CreateMachine", func() { client: mockClient, } - // Create secret with projectId + // Create secret with projectId and networkId (required for v2 API) secret = &corev1.Secret{ Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + "networkId": []byte("770e8400-e29b-41d4-a716-446655440000"), }, } @@ -93,7 +95,7 @@ var _ = Describe("CreateMachine", func() { var capturedReq *CreateServerRequest var capturedProjectID string - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedProjectID = projectID capturedReq = req return &Server{ @@ -163,7 +165,7 @@ var _ = Describe("CreateMachine", func() { Context("when STACKIT API fails", func() { It("should return Internal error on API failure", func() { - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { return nil, fmt.Errorf("API connection failed") } diff --git a/pkg/provider/core_create_machine_config_test.go b/pkg/provider/core_create_machine_config_test.go index 500419a6..3677ae2a 100644 --- a/pkg/provider/core_create_machine_config_test.go +++ b/pkg/provider/core_create_machine_config_test.go @@ -35,11 +35,13 @@ var _ = Describe("CreateMachine", func() { client: mockClient, } - // Create secret with projectId + // Create secret with projectId and networkId (required for v2 API) secret = &corev1.Secret{ Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + "networkId": []byte("770e8400-e29b-41d4-a716-446655440000"), }, } @@ -87,7 +89,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -105,7 +107,7 @@ var _ = Describe("CreateMachine", func() { It("should not send KeypairName when empty", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -133,7 +135,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -151,7 +153,7 @@ var _ = Describe("CreateMachine", func() { It("should not send AvailabilityZone when empty", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -179,7 +181,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -197,7 +199,7 @@ var _ = Describe("CreateMachine", func() { It("should not send AffinityGroup when empty", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -225,7 +227,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -245,7 +247,7 @@ var _ = Describe("CreateMachine", func() { It("should not send ServiceAccountMails when empty", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -274,7 +276,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -293,7 +295,7 @@ var _ = Describe("CreateMachine", func() { It("should not send Agent when nil", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -323,7 +325,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -346,7 +348,7 @@ var _ = Describe("CreateMachine", func() { It("should not send Metadata when nil", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", diff --git a/pkg/provider/core_create_machine_networking_test.go b/pkg/provider/core_create_machine_networking_test.go new file mode 100644 index 00000000..faf1edcb --- /dev/null +++ b/pkg/provider/core_create_machine_networking_test.go @@ -0,0 +1,318 @@ +// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + +package provider + +import ( + "context" + + api "github.com/aoepeople/machine-controller-manager-provider-stackit/pkg/provider/apis" + "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1" + "github.com/gardener/machine-controller-manager/pkg/util/provider/driver" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +var _ = Describe("CreateMachine - Networking", func() { + var ( + ctx context.Context + provider *Provider + mockClient *mockStackitClient + req *driver.CreateMachineRequest + secret *corev1.Secret + machineClass *v1alpha1.MachineClass + machine *v1alpha1.Machine + ) + + BeforeEach(func() { + ctx = context.Background() + mockClient = &mockStackitClient{} + provider = &Provider{ + client: mockClient, + } + + // Create secret with basic required fields + secret = &corev1.Secret{ + Data: map[string][]byte{ + "projectId": []byte("11111111-2222-3333-4444-555555555555"), + "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + }, + } + + // Create Machine + machine = &v1alpha1.Machine{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-machine", + Namespace: "default", + }, + } + }) + + Context("with networking configuration in ProviderSpec", func() { + It("should use networkId from ProviderSpec", func() { + providerSpec := &api.ProviderSpec{ + MachineType: "c1.2", + ImageID: "12345678-1234-1234-1234-123456789abc", + Networking: &api.NetworkingSpec{ + NetworkID: "770e8400-e29b-41d4-a716-446655440000", + }, + } + providerSpecRaw, _ := encodeProviderSpec(providerSpec) + + machineClass = &v1alpha1.MachineClass{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-machine-class", + }, + ProviderSpec: runtime.RawExtension{ + Raw: providerSpecRaw, + }, + } + + req = &driver.CreateMachineRequest{ + Machine: machine, + MachineClass: machineClass, + Secret: secret, + } + + var capturedReq *CreateServerRequest + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { + capturedReq = req + return &Server{ + ID: "test-server-id", + Name: req.Name, + Status: "CREATING", + }, nil + } + + _, err := provider.CreateMachine(ctx, req) + + Expect(err).NotTo(HaveOccurred()) + Expect(capturedReq.Networking).NotTo(BeNil()) + Expect(capturedReq.Networking.NetworkID).To(Equal("770e8400-e29b-41d4-a716-446655440000")) + Expect(capturedReq.Networking.NICIDs).To(BeEmpty()) + }) + + It("should use nicIds from ProviderSpec", func() { + providerSpec := &api.ProviderSpec{ + MachineType: "c1.2", + ImageID: "12345678-1234-1234-1234-123456789abc", + Networking: &api.NetworkingSpec{ + NICIDs: []string{ + "880e8400-e29b-41d4-a716-446655440001", + "990e8400-e29b-41d4-a716-446655440002", + }, + }, + } + providerSpecRaw, _ := encodeProviderSpec(providerSpec) + + machineClass = &v1alpha1.MachineClass{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-machine-class", + }, + ProviderSpec: runtime.RawExtension{ + Raw: providerSpecRaw, + }, + } + + req = &driver.CreateMachineRequest{ + Machine: machine, + MachineClass: machineClass, + Secret: secret, + } + + var capturedReq *CreateServerRequest + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { + capturedReq = req + return &Server{ + ID: "test-server-id", + Name: req.Name, + Status: "CREATING", + }, nil + } + + _, err := provider.CreateMachine(ctx, req) + + Expect(err).NotTo(HaveOccurred()) + Expect(capturedReq.Networking).NotTo(BeNil()) + Expect(capturedReq.Networking.NetworkID).To(BeEmpty()) + Expect(capturedReq.Networking.NICIDs).To(HaveLen(2)) + Expect(capturedReq.Networking.NICIDs[0]).To(Equal("880e8400-e29b-41d4-a716-446655440001")) + Expect(capturedReq.Networking.NICIDs[1]).To(Equal("990e8400-e29b-41d4-a716-446655440002")) + }) + }) + + Context("with networking fallback to Secret", func() { + It("should use networkId from Secret when ProviderSpec.Networking is nil", func() { + // Add networkId to Secret + secret.Data["networkId"] = []byte("660e8400-e29b-41d4-a716-446655440000") + + providerSpec := &api.ProviderSpec{ + MachineType: "c1.2", + ImageID: "12345678-1234-1234-1234-123456789abc", + // Networking is nil - should fall back to Secret + } + providerSpecRaw, _ := encodeProviderSpec(providerSpec) + + machineClass = &v1alpha1.MachineClass{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-machine-class", + }, + ProviderSpec: runtime.RawExtension{ + Raw: providerSpecRaw, + }, + } + + req = &driver.CreateMachineRequest{ + Machine: machine, + MachineClass: machineClass, + Secret: secret, + } + + var capturedReq *CreateServerRequest + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { + capturedReq = req + return &Server{ + ID: "test-server-id", + Name: req.Name, + Status: "CREATING", + }, nil + } + + _, err := provider.CreateMachine(ctx, req) + + Expect(err).NotTo(HaveOccurred()) + Expect(capturedReq.Networking).NotTo(BeNil()) + Expect(capturedReq.Networking.NetworkID).To(Equal("660e8400-e29b-41d4-a716-446655440000")) + Expect(capturedReq.Networking.NICIDs).To(BeEmpty()) + }) + + It("should create empty networking when neither ProviderSpec nor Secret has networkId", func() { + providerSpec := &api.ProviderSpec{ + MachineType: "c1.2", + ImageID: "12345678-1234-1234-1234-123456789abc", + // Networking is nil + } + providerSpecRaw, _ := encodeProviderSpec(providerSpec) + + machineClass = &v1alpha1.MachineClass{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-machine-class", + }, + ProviderSpec: runtime.RawExtension{ + Raw: providerSpecRaw, + }, + } + + req = &driver.CreateMachineRequest{ + Machine: machine, + MachineClass: machineClass, + Secret: secret, // No networkId in secret + } + + var capturedReq *CreateServerRequest + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { + capturedReq = req + return &Server{ + ID: "test-server-id", + Name: req.Name, + Status: "CREATING", + }, nil + } + + _, err := provider.CreateMachine(ctx, req) + + Expect(err).NotTo(HaveOccurred()) + Expect(capturedReq.Networking).NotTo(BeNil()) + Expect(capturedReq.Networking.NetworkID).To(BeEmpty()) + Expect(capturedReq.Networking.NICIDs).To(BeEmpty()) + }) + }) + + Context("with priority of networking configuration", func() { + It("should prioritize ProviderSpec.Networking over Secret.networkId", func() { + // Add networkId to Secret (should be ignored) + secret.Data["networkId"] = []byte("880e8400-e29b-41d4-a716-446655440001") + + providerSpec := &api.ProviderSpec{ + MachineType: "c1.2", + ImageID: "12345678-1234-1234-1234-123456789abc", + Networking: &api.NetworkingSpec{ + NetworkID: "990e8400-e29b-41d4-a716-446655440002", + }, + } + providerSpecRaw, _ := encodeProviderSpec(providerSpec) + + machineClass = &v1alpha1.MachineClass{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-machine-class", + }, + ProviderSpec: runtime.RawExtension{ + Raw: providerSpecRaw, + }, + } + + req = &driver.CreateMachineRequest{ + Machine: machine, + MachineClass: machineClass, + Secret: secret, + } + + var capturedReq *CreateServerRequest + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { + capturedReq = req + return &Server{ + ID: "test-server-id", + Name: req.Name, + Status: "CREATING", + }, nil + } + + _, err := provider.CreateMachine(ctx, req) + + Expect(err).NotTo(HaveOccurred()) + Expect(capturedReq.Networking).NotTo(BeNil()) + Expect(capturedReq.Networking.NetworkID).To(Equal("990e8400-e29b-41d4-a716-446655440002")) + Expect(capturedReq.Networking.NetworkID).NotTo(Equal("880e8400-e29b-41d4-a716-446655440001")) + }) + + It("should reject empty networking in ProviderSpec (validation)", func() { + // Add networkId to Secret + secret.Data["networkId"] = []byte("880e8400-e29b-41d4-a716-446655440001") + + providerSpec := &api.ProviderSpec{ + MachineType: "c1.2", + ImageID: "12345678-1234-1234-1234-123456789abc", + Networking: &api.NetworkingSpec{ + // Both NetworkID and NICIDs are empty - should fail validation + }, + } + providerSpecRaw, _ := encodeProviderSpec(providerSpec) + + machineClass = &v1alpha1.MachineClass{ + ObjectMeta: metav1.ObjectMeta{ + Name: "test-machine-class", + }, + ProviderSpec: runtime.RawExtension{ + Raw: providerSpecRaw, + }, + } + + req = &driver.CreateMachineRequest{ + Machine: machine, + MachineClass: machineClass, + Secret: secret, + } + + _, err := provider.CreateMachine(ctx, req) + + // Should fail validation because networking is specified but empty + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("networking must specify either networkId or nicIds")) + }) + }) +}) diff --git a/pkg/provider/core_create_machine_storage_test.go b/pkg/provider/core_create_machine_storage_test.go index 71082e76..604fa8fc 100644 --- a/pkg/provider/core_create_machine_storage_test.go +++ b/pkg/provider/core_create_machine_storage_test.go @@ -35,11 +35,13 @@ var _ = Describe("CreateMachine", func() { client: mockClient, } - // Create secret with projectId + // Create secret with projectId and networkId (required for v2 API) secret = &corev1.Secret{ Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + "networkId": []byte("770e8400-e29b-41d4-a716-446655440000"), }, } @@ -96,7 +98,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -130,7 +132,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -160,7 +162,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -194,7 +196,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -214,7 +216,7 @@ var _ = Describe("CreateMachine", func() { It("should not send volumes when not specified", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", diff --git a/pkg/provider/core_create_machine_userdata_test.go b/pkg/provider/core_create_machine_userdata_test.go index 03749510..55085f55 100644 --- a/pkg/provider/core_create_machine_userdata_test.go +++ b/pkg/provider/core_create_machine_userdata_test.go @@ -36,11 +36,13 @@ var _ = Describe("CreateMachine", func() { client: mockClient, } - // Create secret with projectId + // Create secret with projectId and networkId (required for v2 API) secret = &corev1.Secret{ Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + "networkId": []byte("770e8400-e29b-41d4-a716-446655440000"), }, } @@ -88,7 +90,7 @@ var _ = Describe("CreateMachine", func() { req.MachineClass.ProviderSpec.Raw = providerSpecRaw var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -109,7 +111,7 @@ var _ = Describe("CreateMachine", func() { secret.Data["userData"] = []byte("#cloud-config\nruncmd:\n - echo 'Hello from Secret'") var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -137,7 +139,7 @@ var _ = Describe("CreateMachine", func() { secret.Data["userData"] = []byte("#cloud-config from Secret") var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -156,7 +158,7 @@ var _ = Describe("CreateMachine", func() { It("should not send userData when neither ProviderSpec nor Secret have it", func() { var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", @@ -176,7 +178,7 @@ var _ = Describe("CreateMachine", func() { secret.Data["userData"] = []byte("") var capturedReq *CreateServerRequest - mockClient.createServerFunc = func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { + mockClient.createServerFunc = func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { capturedReq = req return &Server{ ID: "test-server-id", diff --git a/pkg/provider/core_delete_machine_test.go b/pkg/provider/core_delete_machine_test.go index 9399f3be..7a78834e 100644 --- a/pkg/provider/core_delete_machine_test.go +++ b/pkg/provider/core_delete_machine_test.go @@ -43,6 +43,8 @@ var _ = Describe("DeleteMachine", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + "networkId": []byte("770e8400-e29b-41d4-a716-446655440000"), }, } @@ -84,7 +86,7 @@ var _ = Describe("DeleteMachine", func() { Context("with valid inputs", func() { It("should successfully delete a machine", func() { - mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, serverID string) error { + mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, region, serverID string) error { return nil } @@ -98,7 +100,7 @@ var _ = Describe("DeleteMachine", func() { var capturedProjectID string var capturedServerID string - mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, serverID string) error { + mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, region, serverID string) error { capturedProjectID = projectID capturedServerID = serverID return nil @@ -136,9 +138,9 @@ var _ = Describe("DeleteMachine", func() { }) }) - Context("when server does not exist (idempotency)", func() { - It("should succeed when server is already deleted (NotFound)", func() { - mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, serverID string) error { + Context("when machine not found", func() { + It("should return success if machine does not exist (idempotent)", func() { + mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, region, serverID string) error { return fmt.Errorf("%w: status 404", ErrServerNotFound) } @@ -150,8 +152,8 @@ var _ = Describe("DeleteMachine", func() { }) Context("when STACKIT API fails", func() { - It("should return Internal error on API failure", func() { - mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, serverID string) error { + It("should return error when API call fails", func() { + mockClient.deleteServerFunc = func(ctx context.Context, token, projectID, region, serverID string) error { return fmt.Errorf("API connection failed") } diff --git a/pkg/provider/core_get_machine_status_test.go b/pkg/provider/core_get_machine_status_test.go index bd51b00a..b06905b4 100644 --- a/pkg/provider/core_get_machine_status_test.go +++ b/pkg/provider/core_get_machine_status_test.go @@ -43,6 +43,8 @@ var _ = Describe("GetMachineStatus", func() { Data: map[string][]byte{ "projectId": []byte("11111111-2222-3333-4444-555555555555"), "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + "networkId": []byte("770e8400-e29b-41d4-a716-446655440000"), }, } @@ -84,7 +86,7 @@ var _ = Describe("GetMachineStatus", func() { Context("with valid inputs", func() { It("should successfully get machine status when server exists", func() { - mockClient.getServerFunc = func(ctx context.Context, token, projectID, serverID string) (*Server, error) { + mockClient.getServerFunc = func(ctx context.Context, token, projectID, region, serverID string) (*Server, error) { return &Server{ ID: serverID, Name: "test-machine", @@ -104,7 +106,7 @@ var _ = Describe("GetMachineStatus", func() { var capturedProjectID string var capturedServerID string - mockClient.getServerFunc = func(ctx context.Context, token, projectID, serverID string) (*Server, error) { + mockClient.getServerFunc = func(ctx context.Context, token, projectID, region, serverID string) (*Server, error) { capturedProjectID = projectID capturedServerID = serverID return &Server{ @@ -159,7 +161,7 @@ var _ = Describe("GetMachineStatus", func() { Context("when server does not exist", func() { It("should return NotFound when server is not found", func() { - mockClient.getServerFunc = func(ctx context.Context, token, projectID, serverID string) (*Server, error) { + mockClient.getServerFunc = func(ctx context.Context, token, projectID, region, serverID string) (*Server, error) { return nil, fmt.Errorf("%w: status 404", ErrServerNotFound) } @@ -174,7 +176,7 @@ var _ = Describe("GetMachineStatus", func() { Context("when STACKIT API fails", func() { It("should return Internal error on API failure", func() { - mockClient.getServerFunc = func(ctx context.Context, token, projectID, serverID string) (*Server, error) { + mockClient.getServerFunc = func(ctx context.Context, token, projectID, region, serverID string) (*Server, error) { return nil, fmt.Errorf("API connection failed") } diff --git a/pkg/provider/core_list_machines_test.go b/pkg/provider/core_list_machines_test.go index 28a6c175..047e0472 100644 --- a/pkg/provider/core_list_machines_test.go +++ b/pkg/provider/core_list_machines_test.go @@ -71,7 +71,7 @@ var _ = Describe("ListMachines", func() { Context("with valid inputs", func() { It("should list machines filtered by MachineClass label", func() { - mockClient.listServersFunc = func(ctx context.Context, token, projectID string) ([]*Server, error) { + mockClient.listServersFunc = func(ctx context.Context, token, projectID, region string) ([]*Server, error) { return []*Server{ { ID: "server-1", @@ -111,7 +111,7 @@ var _ = Describe("ListMachines", func() { }) It("should return empty list when no servers match", func() { - mockClient.listServersFunc = func(ctx context.Context, token, projectID string) ([]*Server, error) { + mockClient.listServersFunc = func(ctx context.Context, token, projectID, region string) ([]*Server, error) { return []*Server{ { ID: "server-1", @@ -131,7 +131,7 @@ var _ = Describe("ListMachines", func() { }) It("should return empty list when no servers exist", func() { - mockClient.listServersFunc = func(ctx context.Context, token, projectID string) ([]*Server, error) { + mockClient.listServersFunc = func(ctx context.Context, token, projectID, region string) ([]*Server, error) { return []*Server{}, nil } @@ -143,7 +143,7 @@ var _ = Describe("ListMachines", func() { }) It("should handle servers without labels gracefully", func() { - mockClient.listServersFunc = func(ctx context.Context, token, projectID string) ([]*Server, error) { + mockClient.listServersFunc = func(ctx context.Context, token, projectID, region string) ([]*Server, error) { return []*Server{ { ID: "server-1", @@ -172,7 +172,7 @@ var _ = Describe("ListMachines", func() { Context("when STACKIT API fails", func() { It("should return Internal error on API failure", func() { - mockClient.listServersFunc = func(ctx context.Context, token, projectID string) ([]*Server, error) { + mockClient.listServersFunc = func(ctx context.Context, token, projectID, region string) ([]*Server, error) { return nil, fmt.Errorf("API connection failed") } diff --git a/pkg/provider/core_mocks_test.go b/pkg/provider/core_mocks_test.go index 36cb5b18..f7db86cc 100644 --- a/pkg/provider/core_mocks_test.go +++ b/pkg/provider/core_mocks_test.go @@ -12,15 +12,15 @@ import ( // mockStackitClient is a mock implementation of StackitClient for testing type mockStackitClient struct { - createServerFunc func(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) - getServerFunc func(ctx context.Context, token, projectID, serverID string) (*Server, error) - deleteServerFunc func(ctx context.Context, token, projectID, serverID string) error - listServersFunc func(ctx context.Context, token, projectID string) ([]*Server, error) + createServerFunc func(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) + getServerFunc func(ctx context.Context, token, projectID, region, serverID string) (*Server, error) + deleteServerFunc func(ctx context.Context, token, projectID, region, serverID string) error + listServersFunc func(ctx context.Context, token, projectID, region string) ([]*Server, error) } -func (m *mockStackitClient) CreateServer(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { +func (m *mockStackitClient) CreateServer(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { if m.createServerFunc != nil { - return m.createServerFunc(ctx, token, projectID, req) + return m.createServerFunc(ctx, token, projectID, region, req) } return &Server{ ID: "550e8400-e29b-41d4-a716-446655440000", @@ -29,9 +29,9 @@ func (m *mockStackitClient) CreateServer(ctx context.Context, token, projectID s }, nil } -func (m *mockStackitClient) GetServer(ctx context.Context, token, projectID, serverID string) (*Server, error) { +func (m *mockStackitClient) GetServer(ctx context.Context, token, projectID, region, serverID string) (*Server, error) { if m.getServerFunc != nil { - return m.getServerFunc(ctx, token, projectID, serverID) + return m.getServerFunc(ctx, token, projectID, region, serverID) } return &Server{ ID: serverID, @@ -40,16 +40,16 @@ func (m *mockStackitClient) GetServer(ctx context.Context, token, projectID, ser }, nil } -func (m *mockStackitClient) DeleteServer(ctx context.Context, token, projectID, serverID string) error { +func (m *mockStackitClient) DeleteServer(ctx context.Context, token, projectID, region, serverID string) error { if m.deleteServerFunc != nil { - return m.deleteServerFunc(ctx, token, projectID, serverID) + return m.deleteServerFunc(ctx, token, projectID, region, serverID) } return nil } -func (m *mockStackitClient) ListServers(ctx context.Context, token, projectID string) ([]*Server, error) { +func (m *mockStackitClient) ListServers(ctx context.Context, token, projectID, region string) ([]*Server, error) { if m.listServersFunc != nil { - return m.listServersFunc(ctx, token, projectID) + return m.listServersFunc(ctx, token, projectID, region) } return []*Server{}, nil } diff --git a/pkg/provider/helpers.go b/pkg/provider/helpers.go index 781b235a..271a8bda 100644 --- a/pkg/provider/helpers.go +++ b/pkg/provider/helpers.go @@ -55,3 +55,55 @@ func parseProviderID(providerID string) (projectID, serverID string, err error) return parts[0], parts[1], nil } + +// ========== SDK Conversion Helpers ========== + +// ptr returns a pointer to the given value +// This helper is needed because the STACKIT SDK uses pointers for optional fields +func ptr[T any](v T) *T { + return &v +} + +// convertLabelsToSDK converts map[string]string to *map[string]interface{} for SDK +func convertLabelsToSDK(labels map[string]string) *map[string]interface{} { + if labels == nil { + return nil + } + + result := make(map[string]interface{}, len(labels)) + for k, v := range labels { + result[k] = v + } + return &result +} + +// convertLabelsFromSDK converts *map[string]interface{} from SDK to map[string]string +func convertLabelsFromSDK(labels *map[string]interface{}) map[string]string { + if labels == nil { + return nil + } + + result := make(map[string]string, len(*labels)) + for k, v := range *labels { + if strVal, ok := v.(string); ok { + result[k] = strVal + } + } + return result +} + +// convertStringSliceToSDK converts []string to *[]string for SDK +func convertStringSliceToSDK(slice []string) *[]string { + if slice == nil { + return nil + } + return &slice +} + +// convertMetadataToSDK converts map[string]interface{} to *map[string]interface{} for SDK +func convertMetadataToSDK(metadata map[string]interface{}) *map[string]interface{} { + if metadata == nil { + return nil + } + return &metadata +} diff --git a/pkg/provider/http_client.go b/pkg/provider/http_client.go deleted file mode 100644 index 6b6ed279..00000000 --- a/pkg/provider/http_client.go +++ /dev/null @@ -1,229 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package provider - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "net/http" - "os" - "strconv" - "time" -) - -// Sentinel errors for common HTTP client errors -var ( - // ErrServerNotFound indicates the server was not found (404) - ErrServerNotFound = errors.New("server not found") -) - -// httpStackitClient is an HTTP implementation of StackitClient -type httpStackitClient struct { - baseURL string - httpClient *http.Client -} - -// newHTTPStackitClient creates a new HTTP STACKIT client -func newHTTPStackitClient() *httpStackitClient { - baseURL := os.Getenv("STACKIT_API_ENDPOINT") - if baseURL == "" { - baseURL = "https://api.stackit.cloud" // Default to production - } - - // Configure timeout (default: 30 seconds) - timeout := 30 * time.Second - if timeoutEnv := os.Getenv("STACKIT_API_TIMEOUT"); timeoutEnv != "" { - if timeoutSeconds, err := strconv.Atoi(timeoutEnv); err == nil && timeoutSeconds > 0 { - timeout = time.Duration(timeoutSeconds) * time.Second - } - // If parsing fails or value is invalid, use default timeout - } - - return &httpStackitClient{ - baseURL: baseURL, - httpClient: &http.Client{ - Timeout: timeout, - }, - } -} - -// CreateServer creates a new server via HTTP API -func (c *httpStackitClient) CreateServer(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) { - // Build API path - url := fmt.Sprintf("%s/v1/projects/%s/servers", c.baseURL, projectID) - - // Marshal request body - body, err := json.Marshal(req) - if err != nil { - return nil, fmt.Errorf("failed to marshal request: %w", err) - } - - // Create HTTP request - httpReq, err := http.NewRequestWithContext(ctx, "POST", url, bytes.NewBuffer(body)) - if err != nil { - return nil, fmt.Errorf("failed to create HTTP request: %w", err) - } - - httpReq.Header.Set("Content-Type", "application/json") - httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) - - // Send request - resp, err := c.httpClient.Do(httpReq) - if err != nil { - return nil, fmt.Errorf("HTTP request failed: %w", err) - } - defer func() { _ = resp.Body.Close() }() - - // Read response body - respBody, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("failed to read response body: %w", err) - } - - // Check status code - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return nil, fmt.Errorf("API returned error status %d: %s", resp.StatusCode, string(respBody)) - } - - // Parse response - var server Server - if err := json.Unmarshal(respBody, &server); err != nil { - return nil, fmt.Errorf("failed to parse response: %w", err) - } - - return &server, nil -} - -// GetServer retrieves a server by ID via HTTP API -func (c *httpStackitClient) GetServer(ctx context.Context, token, projectID, serverID string) (*Server, error) { - // Build API path - url := fmt.Sprintf("%s/v1/projects/%s/servers/%s", c.baseURL, projectID, serverID) - - // Create HTTP request - httpReq, err := http.NewRequestWithContext(ctx, "GET", url, nil) - if err != nil { - return nil, fmt.Errorf("failed to create HTTP request: %w", err) - } - - httpReq.Header.Set("Accept", "application/json") - httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) - - // Send request - resp, err := c.httpClient.Do(httpReq) - if err != nil { - return nil, fmt.Errorf("HTTP request failed: %w", err) - } - defer func() { _ = resp.Body.Close() }() - - // Read response body - respBody, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("failed to read response body: %w", err) - } - - // Check status code - if resp.StatusCode == 404 { - return nil, fmt.Errorf("%w: status 404", ErrServerNotFound) - } - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return nil, fmt.Errorf("API returned error status %d: %s", resp.StatusCode, string(respBody)) - } - - // Parse response - var server Server - if err := json.Unmarshal(respBody, &server); err != nil { - return nil, fmt.Errorf("failed to parse response: %w", err) - } - - return &server, nil -} - -// DeleteServer deletes a server by ID via HTTP API -func (c *httpStackitClient) DeleteServer(ctx context.Context, token, projectID, serverID string) error { - // Build API path - url := fmt.Sprintf("%s/v1/projects/%s/servers/%s", c.baseURL, projectID, serverID) - - // Create HTTP request - httpReq, err := http.NewRequestWithContext(ctx, "DELETE", url, nil) - if err != nil { - return fmt.Errorf("failed to create HTTP request: %w", err) - } - - httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) - - // Send request - resp, err := c.httpClient.Do(httpReq) - if err != nil { - return fmt.Errorf("HTTP request failed: %w", err) - } - defer func() { _ = resp.Body.Close() }() - - // Read response body (for error messages) - respBody, err := io.ReadAll(resp.Body) - if err != nil { - return fmt.Errorf("failed to read response body: %w", err) - } - - // Check status code - // Success: 204 No Content (according to STACKIT API spec) - if resp.StatusCode == 204 { - return nil - } - - // Not Found: Server already deleted - this is OK (idempotent) - if resp.StatusCode == 404 { - return fmt.Errorf("%w: status 404", ErrServerNotFound) - } - - // All other status codes are errors - return fmt.Errorf("API returned error status %d: %s", resp.StatusCode, string(respBody)) -} - -// ListServers lists all servers in a project via HTTP API -func (c *httpStackitClient) ListServers(ctx context.Context, token, projectID string) ([]*Server, error) { - // Build API path - url := fmt.Sprintf("%s/v1/projects/%s/servers", c.baseURL, projectID) - - // Create HTTP request - httpReq, err := http.NewRequestWithContext(ctx, "GET", url, nil) - if err != nil { - return nil, fmt.Errorf("failed to create HTTP request: %w", err) - } - - httpReq.Header.Set("Accept", "application/json") - httpReq.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) - - // Send request - resp, err := c.httpClient.Do(httpReq) - if err != nil { - return nil, fmt.Errorf("HTTP request failed: %w", err) - } - defer func() { _ = resp.Body.Close() }() - - // Read response body - respBody, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("failed to read response body: %w", err) - } - - // Check status code - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return nil, fmt.Errorf("API returned error status %d: %s", resp.StatusCode, string(respBody)) - } - - // Parse response - the API returns an object with "items" array - var listResponse struct { - Items []*Server `json:"items"` - } - if err := json.Unmarshal(respBody, &listResponse); err != nil { - return nil, fmt.Errorf("failed to parse response: %w", err) - } - - return listResponse.Items, nil -} diff --git a/pkg/provider/http_client_config_test.go b/pkg/provider/http_client_config_test.go deleted file mode 100644 index a25ee8d5..00000000 --- a/pkg/provider/http_client_config_test.go +++ /dev/null @@ -1,169 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package provider - -import ( - "context" - "net/http" - "net/http/httptest" - "os" - "time" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("HTTP Client", func() { - var ( - server *httptest.Server - client *httpStackitClient - ctx context.Context - projectID string - token string - ) - - BeforeEach(func() { - ctx = context.Background() - projectID = "11111111-2222-3333-4444-555555555555" - token = "test-token-12345" - }) - - AfterEach(func() { - if server != nil { - server.Close() - } - }) - - Describe("newHTTPStackitClient", func() { - It("should use environment variable for base URL", func() { - // Save original env - originalEnv := os.Getenv("STACKIT_API_ENDPOINT") - defer func() { - if originalEnv != "" { - _ = os.Setenv("STACKIT_API_ENDPOINT", originalEnv) - } else { - _ = os.Unsetenv("STACKIT_API_ENDPOINT") - } - }() - - _ = os.Setenv("STACKIT_API_ENDPOINT", "https://custom.api.example.com") - client := newHTTPStackitClient() - - Expect(client.baseURL).To(Equal("https://custom.api.example.com")) - }) - - It("should use default URL when environment variable is not set", func() { - // Save original env - originalEnv := os.Getenv("STACKIT_API_ENDPOINT") - defer func() { - if originalEnv != "" { - _ = os.Setenv("STACKIT_API_ENDPOINT", originalEnv) - } else { - _ = os.Unsetenv("STACKIT_API_ENDPOINT") - } - }() - - _ = os.Unsetenv("STACKIT_API_ENDPOINT") - client := newHTTPStackitClient() - - Expect(client.baseURL).To(Equal("https://api.stackit.cloud")) - }) - }) - - Describe("Timeout Configuration", func() { - It("should have 30-second default timeout", func() { - // Save original env - originalEnv := os.Getenv("STACKIT_API_TIMEOUT") - defer func() { - if originalEnv != "" { - _ = os.Setenv("STACKIT_API_TIMEOUT", originalEnv) - } else { - _ = os.Unsetenv("STACKIT_API_TIMEOUT") - } - }() - - _ = os.Unsetenv("STACKIT_API_TIMEOUT") - client := newHTTPStackitClient() - - Expect(client.httpClient.Timeout).To(Equal(30 * time.Second)) - }) - - It("should use custom timeout from environment variable", func() { - // Save original env - originalEnv := os.Getenv("STACKIT_API_TIMEOUT") - defer func() { - if originalEnv != "" { - _ = os.Setenv("STACKIT_API_TIMEOUT", originalEnv) - } else { - _ = os.Unsetenv("STACKIT_API_TIMEOUT") - } - }() - - _ = os.Setenv("STACKIT_API_TIMEOUT", "60") - client := newHTTPStackitClient() - - Expect(client.httpClient.Timeout).To(Equal(60 * time.Second)) - }) - - It("should use default timeout when environment variable is invalid", func() { - // Save original env - originalEnv := os.Getenv("STACKIT_API_TIMEOUT") - defer func() { - if originalEnv != "" { - _ = os.Setenv("STACKIT_API_TIMEOUT", originalEnv) - } else { - _ = os.Unsetenv("STACKIT_API_TIMEOUT") - } - }() - - _ = os.Setenv("STACKIT_API_TIMEOUT", "invalid") - client := newHTTPStackitClient() - - Expect(client.httpClient.Timeout).To(Equal(30 * time.Second)) - }) - - It("should use default timeout when environment variable is negative", func() { - // Save original env - originalEnv := os.Getenv("STACKIT_API_TIMEOUT") - defer func() { - if originalEnv != "" { - _ = os.Setenv("STACKIT_API_TIMEOUT", originalEnv) - } else { - _ = os.Unsetenv("STACKIT_API_TIMEOUT") - } - }() - - _ = os.Setenv("STACKIT_API_TIMEOUT", "-10") - client := newHTTPStackitClient() - - Expect(client.httpClient.Timeout).To(Equal(30 * time.Second)) - }) - - It("should timeout on slow CreateServer request", func() { - // Create a server that delays response longer than timeout - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - time.Sleep(100 * time.Millisecond) // Delay longer than client timeout - w.WriteHeader(http.StatusOK) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{ - Timeout: 10 * time.Millisecond, // Very short timeout for testing - }, - } - - req := &CreateServerRequest{ - Name: "test-machine", - MachineType: "c2i.2", - } - - _, err := client.CreateServer(ctx, token, projectID, req) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("HTTP request failed")) - }) - }) -}) diff --git a/pkg/provider/http_client_create_test.go b/pkg/provider/http_client_create_test.go deleted file mode 100644 index a0785c97..00000000 --- a/pkg/provider/http_client_create_test.go +++ /dev/null @@ -1,176 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package provider - -import ( - "context" - "io" - "net/http" - "net/http/httptest" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("HTTP Client", func() { - var ( - server *httptest.Server - client *httpStackitClient - ctx context.Context - projectID string - token string - ) - - BeforeEach(func() { - ctx = context.Background() - projectID = "11111111-2222-3333-4444-555555555555" - token = "test-token-12345" - }) - - AfterEach(func() { - if server != nil { - server.Close() - } - }) - - Describe("CreateServer", func() { - Context("with successful API response", func() { - It("should create a server successfully", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - Expect(r.Method).To(Equal("POST")) - Expect(r.URL.Path).To(Equal("/v1/projects/11111111-2222-3333-4444-555555555555/servers")) - Expect(r.Header.Get("Content-Type")).To(Equal("application/json")) - - w.WriteHeader(http.StatusOK) - _, _ = w.Write([]byte(`{ - "id": "550e8400-e29b-41d4-a716-446655440000", - "name": "test-machine", - "status": "CREATING" - }`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - req := &CreateServerRequest{ - Name: "test-machine", - MachineType: "c2i.2", - ImageID: "image-123", - } - - result, err := client.CreateServer(ctx, token, projectID, req) - - Expect(err).NotTo(HaveOccurred()) - Expect(result).NotTo(BeNil()) - Expect(result.ID).To(Equal("550e8400-e29b-41d4-a716-446655440000")) - Expect(result.Name).To(Equal("test-machine")) - Expect(result.Status).To(Equal("CREATING")) - }) - - It("should send correct request body", func() { - var receivedBody []byte - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - receivedBody, _ = io.ReadAll(r.Body) - w.WriteHeader(http.StatusOK) - _, _ = w.Write([]byte(`{"id":"123","name":"test","status":"OK"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - req := &CreateServerRequest{ - Name: "my-server", - MachineType: "c1.4", - ImageID: "img-789", - } - - _, err := client.CreateServer(ctx, token, projectID, req) - - Expect(err).NotTo(HaveOccurred()) - Expect(string(receivedBody)).To(ContainSubstring(`"name":"my-server"`)) - Expect(string(receivedBody)).To(ContainSubstring(`"machineType":"c1.4"`)) - Expect(string(receivedBody)).To(ContainSubstring(`"imageId":"img-789"`)) - }) - }) - - Context("with API errors", func() { - It("should return error on 400 Bad Request", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusBadRequest) - _, _ = w.Write([]byte(`{"error": "Invalid machine type"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - req := &CreateServerRequest{ - Name: "test-machine", - MachineType: "invalid", - ImageID: "image-123", - } - - result, err := client.CreateServer(ctx, token, projectID, req) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("API returned error status 400")) - Expect(result).To(BeNil()) - }) - - It("should return error on 500 Internal Server Error", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusInternalServerError) - _, _ = w.Write([]byte(`{"error": "Internal server error"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - req := &CreateServerRequest{ - Name: "test-machine", - MachineType: "c2i.2", - ImageID: "image-123", - } - - result, err := client.CreateServer(ctx, token, projectID, req) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("API returned error status 500")) - Expect(result).To(BeNil()) - }) - - It("should return error on invalid JSON response", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - _, _ = w.Write([]byte(`{invalid json}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - req := &CreateServerRequest{ - Name: "test-machine", - MachineType: "c2i.2", - ImageID: "image-123", - } - - result, err := client.CreateServer(ctx, token, projectID, req) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("failed to parse response")) - Expect(result).To(BeNil()) - }) - }) - }) -}) diff --git a/pkg/provider/http_client_delete_test.go b/pkg/provider/http_client_delete_test.go deleted file mode 100644 index cf82f01a..00000000 --- a/pkg/provider/http_client_delete_test.go +++ /dev/null @@ -1,130 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package provider - -import ( - "context" - "net/http" - "net/http/httptest" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("HTTP Client", func() { - var ( - server *httptest.Server - client *httpStackitClient - ctx context.Context - projectID string - serverID string - token string - ) - - BeforeEach(func() { - ctx = context.Background() - projectID = "11111111-2222-3333-4444-555555555555" - serverID = "test-server-456" - token = "test-token-12345" - }) - - AfterEach(func() { - if server != nil { - server.Close() - } - }) - - - Describe("DeleteServer", func() { - Context("with successful API response", func() { - It("should delete server successfully", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - Expect(r.Method).To(Equal("DELETE")) - Expect(r.URL.Path).To(Equal("/v1/projects/11111111-2222-3333-4444-555555555555/servers/test-server-456")) - - // Real STACKIT API returns 204 No Content on successful DELETE - w.WriteHeader(http.StatusNoContent) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - err := client.DeleteServer(ctx, token, projectID, serverID) - - Expect(err).NotTo(HaveOccurred()) - }) - - It("should accept 204 No Content response", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusNoContent) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - err := client.DeleteServer(ctx, token, projectID, serverID) - - Expect(err).NotTo(HaveOccurred()) - }) - }) - - Context("with API errors", func() { - It("should return error on 404 Not Found (server already deleted)", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusNotFound) - _, _ = w.Write([]byte(`{"error": "Server not found"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - err := client.DeleteServer(ctx, token, projectID, serverID) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(ContainSubstring("server not found"))) - }) - - It("should return error on 403 Forbidden", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusForbidden) - _, _ = w.Write([]byte(`{"error": "Access denied"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - err := client.DeleteServer(ctx, token, projectID, serverID) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("API returned error status 403")) - }) - - It("should return error on 500 Internal Server Error", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusInternalServerError) - _, _ = w.Write([]byte(`{"error": "Internal error"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - err := client.DeleteServer(ctx, token, projectID, serverID) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("API returned error status 500")) - }) - }) - }) -}) diff --git a/pkg/provider/http_client_get_test.go b/pkg/provider/http_client_get_test.go deleted file mode 100644 index 7527010e..00000000 --- a/pkg/provider/http_client_get_test.go +++ /dev/null @@ -1,127 +0,0 @@ -// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors -// -// SPDX-License-Identifier: Apache-2.0 - -package provider - -import ( - "context" - "net/http" - "net/http/httptest" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -var _ = Describe("HTTP Client", func() { - var ( - server *httptest.Server - client *httpStackitClient - ctx context.Context - projectID string - serverID string - token string - ) - - BeforeEach(func() { - ctx = context.Background() - projectID = "11111111-2222-3333-4444-555555555555" - serverID = "test-server-456" - token = "test-token-12345" - }) - - AfterEach(func() { - if server != nil { - server.Close() - } - }) - - - Describe("GetServer", func() { - Context("with successful API response", func() { - It("should get server status successfully", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - Expect(r.Method).To(Equal("GET")) - Expect(r.URL.Path).To(Equal("/v1/projects/11111111-2222-3333-4444-555555555555/servers/test-server-456")) - Expect(r.Header.Get("Accept")).To(Equal("application/json")) - - w.WriteHeader(http.StatusOK) - _, _ = w.Write([]byte(`{ - "id": "test-server-456", - "name": "test-machine", - "status": "RUNNING" - }`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - result, err := client.GetServer(ctx, token, projectID, serverID) - - Expect(err).NotTo(HaveOccurred()) - Expect(result).NotTo(BeNil()) - Expect(result.ID).To(Equal("test-server-456")) - Expect(result.Name).To(Equal("test-machine")) - Expect(result.Status).To(Equal("RUNNING")) - }) - }) - - Context("with API errors", func() { - It("should return error on 404 Not Found", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusNotFound) - _, _ = w.Write([]byte(`{"error": "Server not found"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - result, err := client.GetServer(ctx, token, projectID, serverID) - - Expect(err).To(HaveOccurred()) - Expect(err).To(MatchError(ContainSubstring("server not found"))) - Expect(result).To(BeNil()) - }) - - It("should return error on 403 Forbidden", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusForbidden) - _, _ = w.Write([]byte(`{"error": "Access denied"}`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - result, err := client.GetServer(ctx, token, projectID, serverID) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("API returned error status 403")) - Expect(result).To(BeNil()) - }) - - It("should return error on invalid JSON response", func() { - server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - _, _ = w.Write([]byte(`not valid json`)) - })) - - client = &httpStackitClient{ - baseURL: server.URL, - httpClient: &http.Client{}, - } - - result, err := client.GetServer(ctx, token, projectID, serverID) - - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("failed to parse response")) - Expect(result).To(BeNil()) - }) - }) - }) -}) diff --git a/pkg/provider/provider.go b/pkg/provider/provider.go index ee9be484..881fac4a 100644 --- a/pkg/provider/provider.go +++ b/pkg/provider/provider.go @@ -21,6 +21,6 @@ type Provider struct { func NewProvider(spi spi.SessionProviderInterface) driver.Driver { return &Provider{ SPI: spi, - client: newHTTPStackitClient(), // Initialize HTTP client for STACKIT API + client: newSDKStackitClient(), // Initialize SDK client for STACKIT API } } diff --git a/pkg/provider/sdk_client.go b/pkg/provider/sdk_client.go new file mode 100644 index 00000000..eaa3ffeb --- /dev/null +++ b/pkg/provider/sdk_client.go @@ -0,0 +1,316 @@ +// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + +package provider + +import ( + "context" + "errors" + "fmt" + "os" + "regexp" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" + "github.com/stackitcloud/stackit-sdk-go/services/iaas" +) + +// sdkStackitClient is an SDK implementation of StackitClient +// It is stateless and creates SDK API clients per-request to support +// different credentials per MachineClass +type sdkStackitClient struct{} + +// newSDKStackitClient creates a new stateless SDK STACKIT client wrapper +func newSDKStackitClient() *sdkStackitClient { + return &sdkStackitClient{} +} + +var ( + // ErrServerNotFound indicates the server was not found (404) + ErrServerNotFound = errors.New("server not found") +) + +// createIAASClient creates a new STACKIT SDK IAAS API client for a request +// This allows different MachineClasses to use different credentials +func (c *sdkStackitClient) createIAASClient(token string) (*iaas.APIClient, error) { + // Configure SDK with custom base URL if provided (for testing with mock server) + baseURL := os.Getenv("STACKIT_API_ENDPOINT") + + var opts []config.ConfigurationOption + opts = append(opts, config.WithToken(token)) + + if baseURL != "" { + opts = append(opts, config.WithEndpoint(baseURL)) + } + + iaasClient, err := iaas.NewAPIClient(opts...) + if err != nil { + return nil, fmt.Errorf("failed to create STACKIT SDK API client: %w", err) + } + + return iaasClient, nil +} + +// validRegionPattern matches STACKIT region formats like "eu01-1", "eu01-2" +// Pattern: <2 letters><2 digits>- +var validRegionPattern = regexp.MustCompile(`^[a-z]{2}\d{2}-\d+$`) + +// extractRegion extracts and validates the region from the secret data +// Region is required by STACKIT SDK v1.0.0+ +func extractRegion(secretData map[string][]byte) (string, error) { + region, ok := secretData["region"] + if !ok || len(region) == 0 { + return "", fmt.Errorf("'region' field is required in Secret (e.g., 'eu01-1')") + } + + regionStr := string(region) + + // Validate region format + if !validRegionPattern.MatchString(regionStr) { + return "", fmt.Errorf("invalid region format '%s': must match pattern '-' (e.g., 'eu01-1', 'eu01-2')", regionStr) + } + + return regionStr, nil +} + +// CreateServer creates a new server via STACKIT SDK +func (c *sdkStackitClient) CreateServer(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) { + // Create SDK client for this request + iaasClient, err := c.createIAASClient(token) + if err != nil { + return nil, fmt.Errorf("failed to create SDK client: %w", err) + } + + // Convert our request to SDK payload + payload := &iaas.CreateServerPayload{ + Name: ptr(req.Name), + MachineType: ptr(req.MachineType), + } + + // ImageID (optional - can be nil if booting from snapshot/volume) + if req.ImageID != "" { + payload.ImageId = ptr(req.ImageID) + } + + // Labels + if req.Labels != nil { + payload.Labels = convertLabelsToSDK(req.Labels) + } + + // Networking - Required in v2 API, SDK uses union type: either NetworkId OR NicIds + // + // Precedence (mutually exclusive): + // 1. If NetworkID is set (non-empty), use it (ignores NICIDs if both are set) + // 2. If NICIDs is set (non-empty slice), use it + // 3. Otherwise, create empty networking object (v2 API requirement) + // + // This matches the STACKIT API behavior where you can either: + // - Auto-create NICs in a network (NetworkID) + // - Use pre-created NICs (NICIDs) + if req.Networking != nil { + if req.Networking.NetworkID != "" { + // Use CreateServerNetworking (with networkId) + // This will auto-create a NIC in the specified network + networking := iaas.NewCreateServerNetworking() + networking.SetNetworkId(req.Networking.NetworkID) + payload.SetNetworking(iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(networking)) + } else if len(req.Networking.NICIDs) > 0 { + // Use CreateServerNetworkingWithNics (with nicIds) + // This attaches pre-existing NICs to the server + networking := iaas.NewCreateServerNetworkingWithNics() + networking.SetNicIds(req.Networking.NICIDs) + payload.SetNetworking(iaas.CreateServerNetworkingWithNicsAsCreateServerPayloadAllOfNetworking(networking)) + } else { + // Empty networking object (v2 API requires networking field even if empty) + networking := iaas.NewCreateServerNetworking() + payload.SetNetworking(iaas.CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(networking)) + } + } + + // Security Groups + if len(req.SecurityGroups) > 0 { + payload.SecurityGroups = convertStringSliceToSDK(req.SecurityGroups) + } + + // UserData - SDK expects *[]byte (base64-encoded bytes) + if req.UserData != "" { + userDataBytes := []byte(req.UserData) + payload.SetUserData(userDataBytes) + } + + // Boot Volume + if req.BootVolume != nil { + bootVolume := iaas.NewServerBootVolume() + if req.BootVolume.Size > 0 { + bootVolume.SetSize(int64(req.BootVolume.Size)) + } + if req.BootVolume.PerformanceClass != "" { + bootVolume.SetPerformanceClass(req.BootVolume.PerformanceClass) + } + if req.BootVolume.DeleteOnTermination != nil { + bootVolume.SetDeleteOnTermination(*req.BootVolume.DeleteOnTermination) + } + if req.BootVolume.Source != nil { + source := iaas.NewBootVolumeSource(req.BootVolume.Source.ID, req.BootVolume.Source.Type) + bootVolume.SetSource(*source) + } + payload.SetBootVolume(*bootVolume) + } + + // Volumes + if len(req.Volumes) > 0 { + payload.Volumes = convertStringSliceToSDK(req.Volumes) + } + + // KeypairName + if req.KeypairName != "" { + payload.KeypairName = ptr(req.KeypairName) + } + + // AvailabilityZone + if req.AvailabilityZone != "" { + payload.AvailabilityZone = ptr(req.AvailabilityZone) + } + + // AffinityGroup + if req.AffinityGroup != "" { + payload.AffinityGroup = ptr(req.AffinityGroup) + } + + // ServiceAccountMails + if len(req.ServiceAccountMails) > 0 { + payload.ServiceAccountMails = convertStringSliceToSDK(req.ServiceAccountMails) + } + + // Agent + if req.Agent != nil { + payload.Agent = &iaas.ServerAgent{ + Provisioned: req.Agent.Provisioned, + } + } + + // Metadata + if req.Metadata != nil { + payload.Metadata = convertMetadataToSDK(req.Metadata) + } + + // Call SDK + sdkServer, err := iaasClient.CreateServer(ctx, projectID, region). + CreateServerPayload(*payload). + Execute() + if err != nil { + return nil, fmt.Errorf("SDK CreateServer failed: %w", err) + } + + // Convert SDK server to our Server type + server := &Server{ + ID: getStringValue(sdkServer.Id), + Name: getStringValue(sdkServer.Name), + Status: getStringValue(sdkServer.Status), + Labels: convertLabelsFromSDK(sdkServer.Labels), + } + + return server, nil +} + +// GetServer retrieves a server by ID via STACKIT SDK +func (c *sdkStackitClient) GetServer(ctx context.Context, token, projectID, region, serverID string) (*Server, error) { + // Create SDK client for this request + iaasClient, err := c.createIAASClient(token) + if err != nil { + return nil, fmt.Errorf("failed to create SDK client: %w", err) + } + + sdkServer, err := iaasClient.GetServer(ctx, projectID, region, serverID).Execute() + if err != nil { + // Check if error is 404 Not Found + if isNotFoundError(err) { + return nil, fmt.Errorf("%w: %v", ErrServerNotFound, err) + } + return nil, fmt.Errorf("SDK GetServer failed: %w", err) + } + + // Convert SDK server to our Server type + server := &Server{ + ID: getStringValue(sdkServer.Id), + Name: getStringValue(sdkServer.Name), + Status: getStringValue(sdkServer.Status), + Labels: convertLabelsFromSDK(sdkServer.Labels), + } + + return server, nil +} + +// DeleteServer deletes a server by ID via STACKIT SDK +func (c *sdkStackitClient) DeleteServer(ctx context.Context, token, projectID, region, serverID string) error { + // Create SDK client for this request + iaasClient, err := c.createIAASClient(token) + if err != nil { + return fmt.Errorf("failed to create SDK client: %w", err) + } + + err = iaasClient.DeleteServer(ctx, projectID, region, serverID).Execute() + if err != nil { + // Check if error is 404 Not Found - this is OK (idempotent) + if isNotFoundError(err) { + return fmt.Errorf("%w: %v", ErrServerNotFound, err) + } + return fmt.Errorf("SDK DeleteServer failed: %w", err) + } + + return nil +} + +// ListServers lists all servers in a project via STACKIT SDK +func (c *sdkStackitClient) ListServers(ctx context.Context, token, projectID, region string) ([]*Server, error) { + // Create SDK client for this request + iaasClient, err := c.createIAASClient(token) + if err != nil { + return nil, fmt.Errorf("failed to create SDK client: %w", err) + } + + sdkResponse, err := iaasClient.ListServers(ctx, projectID, region).Execute() + if err != nil { + return nil, fmt.Errorf("SDK ListServers failed: %w", err) + } + + // Convert SDK servers to our Server type + servers := make([]*Server, 0) + if sdkResponse.Items != nil { + for _, sdkServer := range *sdkResponse.Items { + server := &Server{ + ID: getStringValue(sdkServer.Id), + Name: getStringValue(sdkServer.Name), + Status: getStringValue(sdkServer.Status), + Labels: convertLabelsFromSDK(sdkServer.Labels), + } + servers = append(servers, server) + } + } + + return servers, nil +} + +// Helper functions + +// getStringValue safely dereferences a string pointer, returning empty string if nil +func getStringValue(s *string) string { + if s == nil { + return "" + } + return *s +} + +// isNotFoundError checks if an error is a 404 Not Found error from the SDK +func isNotFoundError(err error) bool { + if err == nil { + return false + } + // Use the SDK's structured error type to check the HTTP status code + var oapiErr *oapierror.GenericOpenAPIError + if errors.As(err, &oapiErr) { + return oapiErr.StatusCode == 404 + } + return false +} diff --git a/pkg/provider/sdk_client_test.go b/pkg/provider/sdk_client_test.go new file mode 100644 index 00000000..d9829380 --- /dev/null +++ b/pkg/provider/sdk_client_test.go @@ -0,0 +1,505 @@ +// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors +// +// SPDX-License-Identifier: Apache-2.0 + +package provider + +import ( + "errors" + "fmt" + + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("SDK Client Helpers", func() { + + Describe("extractRegion", func() { + Context("with valid region", func() { + It("should extract region from secret data", func() { + secretData := map[string][]byte{ + "region": []byte("eu01-1"), + } + + region, err := extractRegion(secretData) + + Expect(err).NotTo(HaveOccurred()) + Expect(region).To(Equal("eu01-1")) + }) + + It("should extract region with different value", func() { + secretData := map[string][]byte{ + "region": []byte("eu01-2"), + } + + region, err := extractRegion(secretData) + + Expect(err).NotTo(HaveOccurred()) + Expect(region).To(Equal("eu01-2")) + }) + + It("should extract region when other fields are present", func() { + secretData := map[string][]byte{ + "projectId": []byte("11111111-2222-3333-4444-555555555555"), + "stackitToken": []byte("test-token-123"), + "region": []byte("eu01-1"), + "userData": []byte("some-user-data"), + } + + region, err := extractRegion(secretData) + + Expect(err).NotTo(HaveOccurred()) + Expect(region).To(Equal("eu01-1")) + }) + }) + + Context("with missing or invalid region", func() { + It("should fail when region field is missing", func() { + secretData := map[string][]byte{ + "projectId": []byte("11111111-2222-3333-4444-555555555555"), + "stackitToken": []byte("test-token-123"), + } + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("'region' field is required")) + Expect(err.Error()).To(ContainSubstring("eu01-1")) + }) + + It("should fail when region field is empty", func() { + secretData := map[string][]byte{ + "region": []byte(""), + } + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("'region' field is required")) + }) + + It("should fail when region field is nil bytes", func() { + secretData := map[string][]byte{ + "region": nil, + } + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("'region' field is required")) + }) + + It("should fail when secret data is empty", func() { + secretData := map[string][]byte{} + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("'region' field is required")) + }) + + It("should fail when secret data is nil", func() { + var secretData map[string][]byte + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("'region' field is required")) + }) + + It("should fail when region has invalid format - missing zone", func() { + secretData := map[string][]byte{ + "region": []byte("eu01"), + } + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("invalid region format")) + Expect(err.Error()).To(ContainSubstring("eu01")) + }) + + It("should fail when region has invalid format - wrong pattern", func() { + secretData := map[string][]byte{ + "region": []byte("invalid-region"), + } + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("invalid region format")) + }) + + It("should fail when region has invalid format - uppercase", func() { + secretData := map[string][]byte{ + "region": []byte("EU01-1"), + } + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("invalid region format")) + }) + + It("should fail when region has invalid format - extra characters", func() { + secretData := map[string][]byte{ + "region": []byte("eu01-1-extra"), + } + + _, err := extractRegion(secretData) + + Expect(err).To(HaveOccurred()) + Expect(err.Error()).To(ContainSubstring("invalid region format")) + }) + }) + }) + + Describe("getStringValue", func() { + Context("with valid pointer", func() { + It("should return string value", func() { + value := "test-string" + result := getStringValue(&value) + + Expect(result).To(Equal("test-string")) + }) + + It("should return empty string when pointer is to empty string", func() { + value := "" + result := getStringValue(&value) + + Expect(result).To(Equal("")) + }) + }) + + Context("with nil pointer", func() { + It("should return empty string when pointer is nil", func() { + result := getStringValue(nil) + + Expect(result).To(Equal("")) + }) + }) + }) + + Describe("isNotFoundError", func() { + Context("with SDK 404 errors", func() { + It("should detect GenericOpenAPIError with 404 status code", func() { + err := &oapierror.GenericOpenAPIError{ + StatusCode: 404, + ErrorMessage: "Not Found", + } + + result := isNotFoundError(err) + + Expect(result).To(BeTrue()) + }) + + It("should detect wrapped GenericOpenAPIError with 404", func() { + baseErr := &oapierror.GenericOpenAPIError{ + StatusCode: 404, + ErrorMessage: "Server not found", + Body: []byte(`{"message": "server does not exist"}`), + } + wrappedErr := fmt.Errorf("failed to get server: %w", baseErr) + + result := isNotFoundError(wrappedErr) + + Expect(result).To(BeTrue()) + }) + }) + + Context("with non-404 errors", func() { + It("should not detect GenericOpenAPIError with 500 status", func() { + err := &oapierror.GenericOpenAPIError{ + StatusCode: 500, + ErrorMessage: "Internal Server Error", + } + + result := isNotFoundError(err) + + Expect(result).To(BeFalse()) + }) + + It("should not detect GenericOpenAPIError with 403 status", func() { + err := &oapierror.GenericOpenAPIError{ + StatusCode: 403, + ErrorMessage: "Forbidden", + } + + result := isNotFoundError(err) + + Expect(result).To(BeFalse()) + }) + + It("should not detect generic error without status code", func() { + err := errors.New("something went wrong") + + result := isNotFoundError(err) + + Expect(result).To(BeFalse()) + }) + + It("should not detect wrapped generic error", func() { + err := fmt.Errorf("API call failed: %w", errors.New("connection timeout")) + + result := isNotFoundError(err) + + Expect(result).To(BeFalse()) + }) + + It("should return false for nil error", func() { + result := isNotFoundError(nil) + + Expect(result).To(BeFalse()) + }) + }) + }) +}) + +var _ = Describe("SDK Type Conversion Helpers", func() { + + Describe("ptr", func() { + It("should create pointer to string", func() { + value := "test" + result := ptr(value) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(Equal("test")) + }) + + It("should create pointer to int", func() { + value := 42 + result := ptr(value) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(Equal(42)) + }) + + It("should create pointer to bool", func() { + value := true + result := ptr(value) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(BeTrue()) + }) + + It("should create pointer to empty string", func() { + value := "" + result := ptr(value) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(Equal("")) + }) + }) + + Describe("convertLabelsToSDK", func() { + Context("with valid labels", func() { + It("should convert labels map to SDK format", func() { + labels := map[string]string{ + "app": "web-server", + "team": "platform", + } + + result := convertLabelsToSDK(labels) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(HaveLen(2)) + Expect((*result)["app"]).To(Equal("web-server")) + Expect((*result)["team"]).To(Equal("platform")) + }) + + It("should convert empty labels map", func() { + labels := map[string]string{} + + result := convertLabelsToSDK(labels) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(BeEmpty()) + }) + + It("should convert labels with special characters", func() { + labels := map[string]string{ + "mcm.gardener.cloud/machine": "test-machine", + "kubernetes.io/role": "node", + } + + result := convertLabelsToSDK(labels) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(HaveLen(2)) + Expect((*result)["mcm.gardener.cloud/machine"]).To(Equal("test-machine")) + Expect((*result)["kubernetes.io/role"]).To(Equal("node")) + }) + }) + + Context("with nil labels", func() { + It("should return nil for nil labels", func() { + result := convertLabelsToSDK(nil) + + Expect(result).To(BeNil()) + }) + }) + }) + + Describe("convertLabelsFromSDK", func() { + Context("with valid SDK labels", func() { + It("should convert SDK labels to string map", func() { + sdkLabels := map[string]interface{}{ + "app": "web-server", + "team": "platform", + } + + result := convertLabelsFromSDK(&sdkLabels) + + Expect(result).NotTo(BeNil()) + Expect(result).To(HaveLen(2)) + Expect(result["app"]).To(Equal("web-server")) + Expect(result["team"]).To(Equal("platform")) + }) + + It("should convert empty SDK labels map", func() { + sdkLabels := map[string]interface{}{} + + result := convertLabelsFromSDK(&sdkLabels) + + Expect(result).NotTo(BeNil()) + Expect(result).To(BeEmpty()) + }) + + It("should skip non-string values", func() { + sdkLabels := map[string]interface{}{ + "app": "web-server", + "count": 42, // not a string + "enabled": true, // not a string + "team": "platform", // string + } + + result := convertLabelsFromSDK(&sdkLabels) + + Expect(result).NotTo(BeNil()) + Expect(result).To(HaveLen(2)) + Expect(result["app"]).To(Equal("web-server")) + Expect(result["team"]).To(Equal("platform")) + Expect(result).NotTo(HaveKey("count")) + Expect(result).NotTo(HaveKey("enabled")) + }) + + It("should handle nil values in map", func() { + sdkLabels := map[string]interface{}{ + "app": "web-server", + "team": nil, + } + + result := convertLabelsFromSDK(&sdkLabels) + + Expect(result).NotTo(BeNil()) + Expect(result).To(HaveLen(1)) + Expect(result["app"]).To(Equal("web-server")) + Expect(result).NotTo(HaveKey("team")) + }) + }) + + Context("with nil SDK labels", func() { + It("should return nil for nil SDK labels", func() { + result := convertLabelsFromSDK(nil) + + Expect(result).To(BeNil()) + }) + }) + }) + + Describe("convertStringSliceToSDK", func() { + Context("with valid slice", func() { + It("should convert string slice to pointer", func() { + slice := []string{"value1", "value2", "value3"} + + result := convertStringSliceToSDK(slice) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(HaveLen(3)) + Expect(*result).To(Equal([]string{"value1", "value2", "value3"})) + }) + + It("should convert empty slice", func() { + slice := []string{} + + result := convertStringSliceToSDK(slice) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(BeEmpty()) + }) + + It("should convert slice with single item", func() { + slice := []string{"only-item"} + + result := convertStringSliceToSDK(slice) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(HaveLen(1)) + Expect((*result)[0]).To(Equal("only-item")) + }) + }) + + Context("with nil slice", func() { + It("should return nil for nil slice", func() { + result := convertStringSliceToSDK(nil) + + Expect(result).To(BeNil()) + }) + }) + }) + + Describe("convertMetadataToSDK", func() { + Context("with valid metadata", func() { + It("should convert metadata map to pointer", func() { + metadata := map[string]interface{}{ + "key1": "value1", + "key2": 42, + "key3": true, + } + + result := convertMetadataToSDK(metadata) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(HaveLen(3)) + Expect((*result)["key1"]).To(Equal("value1")) + Expect((*result)["key2"]).To(Equal(42)) + Expect((*result)["key3"]).To(BeTrue()) + }) + + It("should convert empty metadata map", func() { + metadata := map[string]interface{}{} + + result := convertMetadataToSDK(metadata) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(BeEmpty()) + }) + + It("should convert nested metadata objects", func() { + metadata := map[string]interface{}{ + "config": map[string]interface{}{ + "nested": "value", + }, + "list": []string{"item1", "item2"}, + } + + result := convertMetadataToSDK(metadata) + + Expect(result).NotTo(BeNil()) + Expect(*result).To(HaveLen(2)) + Expect((*result)["config"]).To(BeAssignableToTypeOf(map[string]interface{}{})) + Expect((*result)["list"]).To(BeAssignableToTypeOf([]string{})) + }) + }) + + Context("with nil metadata", func() { + It("should return nil for nil metadata", func() { + result := convertMetadataToSDK(nil) + + Expect(result).To(BeNil()) + }) + }) + }) + +}) diff --git a/pkg/provider/stackit_client.go b/pkg/provider/stackit_client.go index 5c1f6103..68db9a06 100644 --- a/pkg/provider/stackit_client.go +++ b/pkg/provider/stackit_client.go @@ -10,15 +10,18 @@ import ( // StackitClient is an interface for interacting with STACKIT IAAS API // This allows us to mock the client in unit tests +// +// Note: region parameter is required by STACKIT SDK v1.0.0+ +// It must be extracted from the Secret (e.g., "eu01-1", "eu01-2") type StackitClient interface { // CreateServer creates a new server in STACKIT - CreateServer(ctx context.Context, token, projectID string, req *CreateServerRequest) (*Server, error) + CreateServer(ctx context.Context, token, projectID, region string, req *CreateServerRequest) (*Server, error) // GetServer retrieves a server by ID from STACKIT - GetServer(ctx context.Context, token, projectID, serverID string) (*Server, error) + GetServer(ctx context.Context, token, projectID, region, serverID string) (*Server, error) // DeleteServer deletes a server by ID from STACKIT - DeleteServer(ctx context.Context, token, projectID, serverID string) error + DeleteServer(ctx context.Context, token, projectID, region, serverID string) error // ListServers lists all servers in a project - ListServers(ctx context.Context, token, projectID string) ([]*Server, error) + ListServers(ctx context.Context, token, projectID, region string) ([]*Server, error) } // CreateServerRequest represents the request to create a server @@ -27,7 +30,7 @@ type CreateServerRequest struct { MachineType string `json:"machineType"` ImageID string `json:"imageId,omitempty"` Labels map[string]string `json:"labels,omitempty"` - Networking *ServerNetworkingRequest `json:"networking,omitempty"` + Networking *ServerNetworkingRequest `json:"networking"` // Required in v2 API, no omitempty SecurityGroups []string `json:"securityGroups,omitempty"` UserData string `json:"userData,omitempty"` BootVolume *BootVolumeRequest `json:"bootVolume,omitempty"` @@ -41,7 +44,12 @@ type CreateServerRequest struct { } // ServerNetworkingRequest represents the networking configuration for a server -// Use either NetworkID or NICIDs (mutually exclusive) +// +// Union type - use one of the following (mutually exclusive): +// - NetworkID: Auto-create a NIC in the specified network (takes precedence) +// - NICIDs: Attach pre-existing NICs to the server +// +// If both are specified, NetworkID takes precedence and NICIDs is ignored. type ServerNetworkingRequest struct { NetworkID string `json:"networkId,omitempty"` NICIDs []string `json:"nicIds,omitempty"` diff --git a/samples/secret.yaml b/samples/secret.yaml index f8dab97a..4ae31d34 100644 --- a/samples/secret.yaml +++ b/samples/secret.yaml @@ -11,6 +11,10 @@ stringData: # STACKIT API authentication token stackitToken: "your-stackit-api-token-here" + # STACKIT region (required by SDK v1.0.0+) + # Valid regions: eu01-1, eu01-2, etc. + region: "eu01-1" + # Cloud-init user data for VM bootstrapping userData: | #cloud-config diff --git a/test/e2e/e2e_affinity_test.go b/test/e2e/e2e_affinity_test.go index 015eb11b..fef9bf35 100644 --- a/test/e2e/e2e_affinity_test.go +++ b/test/e2e/e2e_affinity_test.go @@ -30,6 +30,8 @@ var _ = Describe("MCM Provider STACKIT", func() { stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_agent_test.go b/test/e2e/e2e_agent_test.go index 4aa626fb..5d9a4093 100644 --- a/test/e2e/e2e_agent_test.go +++ b/test/e2e/e2e_agent_test.go @@ -30,6 +30,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_az_test.go b/test/e2e/e2e_az_test.go index 62e8b792..f8822112 100644 --- a/test/e2e/e2e_az_test.go +++ b/test/e2e/e2e_az_test.go @@ -30,6 +30,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_keypair_test.go b/test/e2e/e2e_keypair_test.go index d73cca69..4a8147df 100644 --- a/test/e2e/e2e_keypair_test.go +++ b/test/e2e/e2e_keypair_test.go @@ -30,6 +30,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_labels_test.go b/test/e2e/e2e_labels_test.go index b99925cc..6b09b193 100644 --- a/test/e2e/e2e_labels_test.go +++ b/test/e2e/e2e_labels_test.go @@ -35,6 +35,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -213,6 +215,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -367,23 +371,32 @@ spec: // This mock test verifies the code path works end-to-end. }) - It("should create Machine without user-provided labels (negative test)", func() { - // KNOWN ISSUE: This test consistently fails with timeout waiting for ProviderID + It("should create Machine without user-provided labels", func() { + // KNOWN ISSUE: Still fails after SDK migration - different root cause than originally suspected // - // Investigation findings: - // - Provider code handles nil labels correctly (core.go:77-81) - // - Validation doesn't require labels (validation.go:32-39) - // - Mock API returns valid responses with ID field (verified via curl) - // - All 9 tests WITH labels pass successfully - // - Test fails in isolation (not test ordering or state pollution) - // - Controller logs show: "Created new VM... with ProviderID: " (empty!) - // - Machine status remains empty (controller never attempts reconciliation) + // Original hypothesis: HTTP client issue with missing labels field + // After SDK migration investigation (2025-11-06): + // - CreateMachine is called by MCM (logs confirm) + // - Provider code (core.go) is NOT executed (no klog messages) + // - No POST request reaches mock IAAS API (confirmed via mock logs) + // - CreateMachine returns successfully but with EMPTY ProviderID // - // Hypothesis: HTTP client or mock API interaction issue when request body - // lacks labels field. Needs persistent cluster access to debug further. + // Current findings: + // - Issue occurs BEFORE our provider code runs + // - Likely in decodeProviderSpec() or validation layer + // - SDK migration did NOT fix this issue + // - Needs investigation with verbose logging (-v=4 or higher) // - // The test serves its purpose - it exposed a real edge case that needs fixing. - Skip("TODO: Debug why CreateServer returns empty ProviderID when labels are missing") + // Evidence from debugging: + // - MCM logs: "Created new VM for machine: 'machine-wn58lb4r' with ProviderID: " (empty!) + // - Provider logs: NO output from core.go:36 (CreateMachine entry point) + // - Mock API logs: NO POST /servers requests for this machine + // + // Next steps: + // - Add debug logging to decodeProviderSpec and validation + // - Check if nil ProviderSpec.Labels causes JSON unmarshal issues + // - Run with -v=4 to see gRPC/driver layer logs + Skip("TODO: Debug why CreateMachine returns empty ProviderID (issue predates SDK migration)") secretName := generateResourceName("secret") machineClassName := generateResourceName("machineclass") @@ -400,6 +413,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_lifecycle_test.go b/test/e2e/e2e_lifecycle_test.go index f84b67f8..77dc6806 100644 --- a/test/e2e/e2e_lifecycle_test.go +++ b/test/e2e/e2e_lifecycle_test.go @@ -30,6 +30,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -134,6 +136,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -228,6 +232,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_metadata_test.go b/test/e2e/e2e_metadata_test.go index f8a3c568..ca45e513 100644 --- a/test/e2e/e2e_metadata_test.go +++ b/test/e2e/e2e_metadata_test.go @@ -30,6 +30,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_networking_test.go b/test/e2e/e2e_networking_test.go index a540b8f5..fe969539 100644 --- a/test/e2e/e2e_networking_test.go +++ b/test/e2e/e2e_networking_test.go @@ -29,6 +29,7 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" userData: | #cloud-config runcmd: @@ -97,6 +98,7 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" userData: | #cloud-config runcmd: @@ -167,6 +169,7 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_service_accounts_test.go b/test/e2e/e2e_service_accounts_test.go index d51b4b08..1323c8a5 100644 --- a/test/e2e/e2e_service_accounts_test.go +++ b/test/e2e/e2e_service_accounts_test.go @@ -30,6 +30,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_userdata_test.go b/test/e2e/e2e_userdata_test.go index 08008e97..f4b30abf 100644 --- a/test/e2e/e2e_userdata_test.go +++ b/test/e2e/e2e_userdata_test.go @@ -32,6 +32,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -105,6 +107,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -174,6 +178,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/test/e2e/e2e_volumes_test.go b/test/e2e/e2e_volumes_test.go index 7bcdd255..771bcf14 100644 --- a/test/e2e/e2e_volumes_test.go +++ b/test/e2e/e2e_volumes_test.go @@ -32,6 +32,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -104,6 +106,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -176,6 +180,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: @@ -250,6 +256,8 @@ type: Opaque stringData: projectId: "12345678-1234-1234-1234-123456789012" stackitToken: "mock-token-for-e2e-tests" + region: "eu01-1" + networkId: "770e8400-e29b-41d4-a716-446655440000" userData: | #cloud-config runcmd: diff --git a/vendor/github.com/golang-jwt/jwt/v5/.gitignore b/vendor/github.com/golang-jwt/jwt/v5/.gitignore new file mode 100644 index 00000000..09573e01 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +bin +.idea/ + diff --git a/vendor/github.com/golang-jwt/jwt/v5/LICENSE b/vendor/github.com/golang-jwt/jwt/v5/LICENSE new file mode 100644 index 00000000..35dbc252 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/LICENSE @@ -0,0 +1,9 @@ +Copyright (c) 2012 Dave Grijalva +Copyright (c) 2021 golang-jwt maintainers + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md new file mode 100644 index 00000000..b3178e75 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/MIGRATION_GUIDE.md @@ -0,0 +1,195 @@ +# Migration Guide (v5.0.0) + +Version `v5` contains a major rework of core functionalities in the `jwt-go` +library. This includes support for several validation options as well as a +re-design of the `Claims` interface. Lastly, we reworked how errors work under +the hood, which should provide a better overall developer experience. + +Starting from [v5.0.0](https://github.com/golang-jwt/jwt/releases/tag/v5.0.0), +the import path will be: + + "github.com/golang-jwt/jwt/v5" + +For most users, changing the import path *should* suffice. However, since we +intentionally changed and cleaned some of the public API, existing programs +might need to be updated. The following sections describe significant changes +and corresponding updates for existing programs. + +## Parsing and Validation Options + +Under the hood, a new `Validator` struct takes care of validating the claims. A +long awaited feature has been the option to fine-tune the validation of tokens. +This is now possible with several `ParserOption` functions that can be appended +to most `Parse` functions, such as `ParseWithClaims`. The most important options +and changes are: + * Added `WithLeeway` to support specifying the leeway that is allowed when + validating time-based claims, such as `exp` or `nbf`. + * Changed default behavior to not check the `iat` claim. Usage of this claim + is OPTIONAL according to the JWT RFC. The claim itself is also purely + informational according to the RFC, so a strict validation failure is not + recommended. If you want to check for sensible values in these claims, + please use the `WithIssuedAt` parser option. + * Added `WithAudience`, `WithSubject` and `WithIssuer` to support checking for + expected `aud`, `sub` and `iss`. + * Added `WithStrictDecoding` and `WithPaddingAllowed` options to allow + previously global settings to enable base64 strict encoding and the parsing + of base64 strings with padding. The latter is strictly speaking against the + standard, but unfortunately some of the major identity providers issue some + of these incorrect tokens. Both options are disabled by default. + +## Changes to the `Claims` interface + +### Complete Restructuring + +Previously, the claims interface was satisfied with an implementation of a +`Valid() error` function. This had several issues: + * The different claim types (struct claims, map claims, etc.) then contained + similar (but not 100 % identical) code of how this validation was done. This + lead to a lot of (almost) duplicate code and was hard to maintain + * It was not really semantically close to what a "claim" (or a set of claims) + really is; which is a list of defined key/value pairs with a certain + semantic meaning. + +Since all the validation functionality is now extracted into the validator, all +`VerifyXXX` and `Valid` functions have been removed from the `Claims` interface. +Instead, the interface now represents a list of getters to retrieve values with +a specific meaning. This allows us to completely decouple the validation logic +with the underlying storage representation of the claim, which could be a +struct, a map or even something stored in a database. + +```go +type Claims interface { + GetExpirationTime() (*NumericDate, error) + GetIssuedAt() (*NumericDate, error) + GetNotBefore() (*NumericDate, error) + GetIssuer() (string, error) + GetSubject() (string, error) + GetAudience() (ClaimStrings, error) +} +``` + +Users that previously directly called the `Valid` function on their claims, +e.g., to perform validation independently of parsing/verifying a token, can now +use the `jwt.NewValidator` function to create a `Validator` independently of the +`Parser`. + +```go +var v = jwt.NewValidator(jwt.WithLeeway(5*time.Second)) +v.Validate(myClaims) +``` + +### Supported Claim Types and Removal of `StandardClaims` + +The two standard claim types supported by this library, `MapClaims` and +`RegisteredClaims` both implement the necessary functions of this interface. The +old `StandardClaims` struct, which has already been deprecated in `v4` is now +removed. + +Users using custom claims, in most cases, will not experience any changes in the +behavior as long as they embedded `RegisteredClaims`. If they created a new +claim type from scratch, they now need to implemented the proper getter +functions. + +### Migrating Application Specific Logic of the old `Valid` + +Previously, users could override the `Valid` method in a custom claim, for +example to extend the validation with application-specific claims. However, this +was always very dangerous, since once could easily disable the standard +validation and signature checking. + +In order to avoid that, while still supporting the use-case, a new +`ClaimsValidator` interface has been introduced. This interface consists of the +`Validate() error` function. If the validator sees, that a `Claims` struct +implements this interface, the errors returned to the `Validate` function will +be *appended* to the regular standard validation. It is not possible to disable +the standard validation anymore (even only by accident). + +Usage examples can be found in [example_test.go](./example_test.go), to build +claims structs like the following. + +```go +// MyCustomClaims includes all registered claims, plus Foo. +type MyCustomClaims struct { + Foo string `json:"foo"` + jwt.RegisteredClaims +} + +// Validate can be used to execute additional application-specific claims +// validation. +func (m MyCustomClaims) Validate() error { + if m.Foo != "bar" { + return errors.New("must be foobar") + } + + return nil +} +``` + +## Changes to the `Token` and `Parser` struct + +The previously global functions `DecodeSegment` and `EncodeSegment` were moved +to the `Parser` and `Token` struct respectively. This will allow us in the +future to configure the behavior of these two based on options supplied on the +parser or the token (creation). This also removes two previously global +variables and moves them to parser options `WithStrictDecoding` and +`WithPaddingAllowed`. + +In order to do that, we had to adjust the way signing methods work. Previously +they were given a base64 encoded signature in `Verify` and were expected to +return a base64 encoded version of the signature in `Sign`, both as a `string`. +However, this made it necessary to have `DecodeSegment` and `EncodeSegment` +global and was a less than perfect design because we were repeating +encoding/decoding steps for all signing methods. Now, `Sign` and `Verify` +operate on a decoded signature as a `[]byte`, which feels more natural for a +cryptographic operation anyway. Lastly, `Parse` and `SignedString` take care of +the final encoding/decoding part. + +In addition to that, we also changed the `Signature` field on `Token` from a +`string` to `[]byte` and this is also now populated with the decoded form. This +is also more consistent, because the other parts of the JWT, mainly `Header` and +`Claims` were already stored in decoded form in `Token`. Only the signature was +stored in base64 encoded form, which was redundant with the information in the +`Raw` field, which contains the complete token as base64. + +```go +type Token struct { + Raw string // Raw contains the raw token + Method SigningMethod // Method is the signing method used or to be used + Header map[string]any // Header is the first segment of the token in decoded form + Claims Claims // Claims is the second segment of the token in decoded form + Signature []byte // Signature is the third segment of the token in decoded form + Valid bool // Valid specifies if the token is valid +} +``` + +Most (if not all) of these changes should not impact the normal usage of this +library. Only users directly accessing the `Signature` field as well as +developers of custom signing methods should be affected. + +# Migration Guide (v4.0.0) + +Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0), +the import path will be: + + "github.com/golang-jwt/jwt/v4" + +The `/v4` version will be backwards compatible with existing `v3.x.y` tags in +this repo, as well as `github.com/dgrijalva/jwt-go`. For most users this should +be a drop-in replacement, if you're having troubles migrating, please open an +issue. + +You can replace all occurrences of `github.com/dgrijalva/jwt-go` or +`github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually +or by using tools such as `sed` or `gofmt`. + +And then you'd typically run: + +``` +go get github.com/golang-jwt/jwt/v4 +go mod tidy +``` + +# Older releases (before v3.2.0) + +The original migration guide for older releases can be found at +https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md. diff --git a/vendor/github.com/golang-jwt/jwt/v5/README.md b/vendor/github.com/golang-jwt/jwt/v5/README.md new file mode 100644 index 00000000..0bb636f2 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/README.md @@ -0,0 +1,167 @@ +# jwt-go + +[![build](https://github.com/golang-jwt/jwt/actions/workflows/build.yml/badge.svg)](https://github.com/golang-jwt/jwt/actions/workflows/build.yml) +[![Go +Reference](https://pkg.go.dev/badge/github.com/golang-jwt/jwt/v5.svg)](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) +[![Coverage Status](https://coveralls.io/repos/github/golang-jwt/jwt/badge.svg?branch=main)](https://coveralls.io/github/golang-jwt/jwt?branch=main) + +A [go](http://www.golang.org) (or 'golang' for search engine friendliness) +implementation of [JSON Web +Tokens](https://datatracker.ietf.org/doc/html/rfc7519). + +Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) +this project adds Go module support, but maintains backward compatibility with +older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`. See the +[`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information. Version +v5.0.0 introduces major improvements to the validation of tokens, but is not +entirely backward compatible. + +> After the original author of the library suggested migrating the maintenance +> of `jwt-go`, a dedicated team of open source maintainers decided to clone the +> existing library into this repository. See +> [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a +> detailed discussion on this topic. + + +**SECURITY NOTICE:** Some older versions of Go have a security issue in the +crypto/elliptic. The recommendation is to upgrade to at least 1.15 See issue +[dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more +detail. + +**SECURITY NOTICE:** It's important that you [validate the `alg` presented is +what you +expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). +This library attempts to make it easy to do the right thing by requiring key +types to match the expected alg, but you should take the extra step to verify it in +your usage. See the examples provided. + +### Supported Go versions + +Our support of Go versions is aligned with Go's [version release +policy](https://golang.org/doc/devel/release#policy). So we will support a major +version of Go until there are two newer major releases. We no longer support +building jwt-go with unsupported Go versions, as these contain security +vulnerabilities that will not be fixed. + +## What the heck is a JWT? + +JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web +Tokens. + +In short, it's a signed JSON object that does something useful (for example, +authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is +made of three parts, separated by `.`'s. The first two parts are JSON objects, +that have been [base64url](https://datatracker.ietf.org/doc/html/rfc4648) +encoded. The last part is the signature, encoded the same way. + +The first part is called the header. It contains the necessary information for +verifying the last part, the signature. For example, which encryption method +was used for signing and what key was used. + +The part in the middle is the interesting bit. It's called the Claims and +contains the actual stuff you care about. Refer to [RFC +7519](https://datatracker.ietf.org/doc/html/rfc7519) for information about +reserved keys and the proper way to add your own. + +## What's in the box? + +This library supports the parsing and verification as well as the generation and +signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, +RSA-PSS, and ECDSA, though hooks are present for adding your own. + +## Installation Guidelines + +1. To install the jwt package, you first need to have + [Go](https://go.dev/doc/install) installed, then you can use the command + below to add `jwt-go` as a dependency in your Go program. + +```sh +go get -u github.com/golang-jwt/jwt/v5 +``` + +2. Import it in your code: + +```go +import "github.com/golang-jwt/jwt/v5" +``` + +## Usage + +A detailed usage guide, including how to sign and verify tokens can be found on +our [documentation website](https://golang-jwt.github.io/jwt/usage/create/). + +## Examples + +See [the project documentation](https://pkg.go.dev/github.com/golang-jwt/jwt/v5) +for examples of usage: + +* [Simple example of parsing and validating a + token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-Parse-Hmac) +* [Simple example of building and signing a + token](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#example-New-Hmac) +* [Directory of + Examples](https://pkg.go.dev/github.com/golang-jwt/jwt/v5#pkg-examples) + +## Compliance + +This library was last reviewed to comply with [RFC +7519](https://datatracker.ietf.org/doc/html/rfc7519) dated May 2015 with a few +notable differences: + +* In order to protect against accidental use of [Unsecured + JWTs](https://datatracker.ietf.org/doc/html/rfc7519#section-6), tokens using + `alg=none` will only be accepted if the constant + `jwt.UnsafeAllowNoneSignatureType` is provided as the key. + +## Project Status & Versioning + +This library is considered production ready. Feedback and feature requests are +appreciated. The API should be considered stable. There should be very few +backward-incompatible changes outside of major version updates (and only with +good reason). + +This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull +requests will land on `main`. Periodically, versions will be tagged from +`main`. You can find all the releases on [the project releases +page](https://github.com/golang-jwt/jwt/releases). + +**BREAKING CHANGES:** A full list of breaking changes is available in +`VERSION_HISTORY.md`. See [`MIGRATION_GUIDE.md`](./MIGRATION_GUIDE.md) for more information on updating +your code. + +## Extensions + +This library publishes all the necessary components for adding your own signing +methods or key functions. Simply implement the `SigningMethod` interface and +register a factory method using `RegisterSigningMethod` or provide a +`jwt.Keyfunc`. + +A common use case would be integrating with different 3rd party signature +providers, like key management services from various cloud providers or Hardware +Security Modules (HSMs) or to implement additional standards. + +| Extension | Purpose | Repo | +| --------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------ | +| GCP | Integrates with multiple Google Cloud Platform signing tools (AppEngine, IAM API, Cloud KMS) | https://github.com/someone1/gcp-jwt-go | +| AWS | Integrates with AWS Key Management Service, KMS | https://github.com/matelang/jwt-go-aws-kms | +| JWKS | Provides support for JWKS ([RFC 7517](https://datatracker.ietf.org/doc/html/rfc7517)) as a `jwt.Keyfunc` | https://github.com/MicahParks/keyfunc | + +*Disclaimer*: Unless otherwise specified, these integrations are maintained by +third parties and should not be considered as a primary offer by any of the +mentioned cloud providers + +## More + +Go package documentation can be found [on +pkg.go.dev](https://pkg.go.dev/github.com/golang-jwt/jwt/v5). Additional +documentation can be found on [our project +page](https://golang-jwt.github.io/jwt/). + +The command line utility included in this project (cmd/jwt) provides a +straightforward example of token creation and parsing as well as a useful tool +for debugging your own integration. You'll also find several implementation +examples in the documentation. + +[golang-jwt](https://github.com/orgs/golang-jwt) incorporates a modified version +of the JWT logo, which is distributed under the terms of the [MIT +License](https://github.com/jsonwebtoken/jsonwebtoken.github.io/blob/master/LICENSE.txt). diff --git a/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md b/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md new file mode 100644 index 00000000..2740597f --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/SECURITY.md @@ -0,0 +1,19 @@ +# Security Policy + +## Supported Versions + +As of November 2024 (and until this document is updated), the latest version `v5` is supported. In critical cases, we might supply back-ported patches for `v4`. + +## Reporting a Vulnerability + +If you think you found a vulnerability, and even if you are not sure, please report it a [GitHub Security Advisory](https://github.com/golang-jwt/jwt/security/advisories/new). Please try be explicit, describe steps to reproduce the security issue with code example(s). + +You will receive a response within a timely manner. If the issue is confirmed, we will do our best to release a patch as soon as possible given the complexity of the problem. + +## Public Discussions + +Please avoid publicly discussing a potential security vulnerability. + +Let's take this offline and find a solution first, this limits the potential impact as much as possible. + +We appreciate your help! diff --git a/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md new file mode 100644 index 00000000..b5039e49 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/VERSION_HISTORY.md @@ -0,0 +1,137 @@ +# `jwt-go` Version History + +The following version history is kept for historic purposes. To retrieve the current changes of each version, please refer to the change-log of the specific release versions on https://github.com/golang-jwt/jwt/releases. + +## 4.0.0 + +* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`. + +## 3.2.2 + +* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)). +* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)). +* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)). +* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)). + +## 3.2.1 + +* **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code + * Changed the import path from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt` +* Fixed type confusing issue between `string` and `[]string` in `VerifyAudience` ([#12](https://github.com/golang-jwt/jwt/pull/12)). This fixes CVE-2020-26160 + +#### 3.2.0 + +* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation +* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate +* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before. +* Deprecated `ParseFromRequestWithClaims` to simplify API in the future. + +#### 3.1.0 + +* Improvements to `jwt` command line tool +* Added `SkipClaimsValidation` option to `Parser` +* Documentation updates + +#### 3.0.0 + +* **Compatibility Breaking Changes**: See MIGRATION_GUIDE.md for tips on updating your code + * Dropped support for `[]byte` keys when using RSA signing methods. This convenience feature could contribute to security vulnerabilities involving mismatched key types with signing methods. + * `ParseFromRequest` has been moved to `request` subpackage and usage has changed + * The `Claims` property on `Token` is now type `Claims` instead of `map[string]interface{}`. The default value is type `MapClaims`, which is an alias to `map[string]interface{}`. This makes it possible to use a custom type when decoding claims. +* Other Additions and Changes + * Added `Claims` interface type to allow users to decode the claims into a custom type + * Added `ParseWithClaims`, which takes a third argument of type `Claims`. Use this function instead of `Parse` if you have a custom type you'd like to decode into. + * Dramatically improved the functionality and flexibility of `ParseFromRequest`, which is now in the `request` subpackage + * Added `ParseFromRequestWithClaims` which is the `FromRequest` equivalent of `ParseWithClaims` + * Added new interface type `Extractor`, which is used for extracting JWT strings from http requests. Used with `ParseFromRequest` and `ParseFromRequestWithClaims`. + * Added several new, more specific, validation errors to error type bitmask + * Moved examples from README to executable example files + * Signing method registry is now thread safe + * Added new property to `ValidationError`, which contains the raw error returned by calls made by parse/verify (such as those returned by keyfunc or json parser) + +#### 2.7.0 + +This will likely be the last backwards compatible release before 3.0.0, excluding essential bug fixes. + +* Added new option `-show` to the `jwt` command that will just output the decoded token without verifying +* Error text for expired tokens includes how long it's been expired +* Fixed incorrect error returned from `ParseRSAPublicKeyFromPEM` +* Documentation updates + +#### 2.6.0 + +* Exposed inner error within ValidationError +* Fixed validation errors when using UseJSONNumber flag +* Added several unit tests + +#### 2.5.0 + +* Added support for signing method none. You shouldn't use this. The API tries to make this clear. +* Updated/fixed some documentation +* Added more helpful error message when trying to parse tokens that begin with `BEARER ` + +#### 2.4.0 + +* Added new type, Parser, to allow for configuration of various parsing parameters + * You can now specify a list of valid signing methods. Anything outside this set will be rejected. + * You can now opt to use the `json.Number` type instead of `float64` when parsing token JSON +* Added support for [Travis CI](https://travis-ci.org/dgrijalva/jwt-go) +* Fixed some bugs with ECDSA parsing + +#### 2.3.0 + +* Added support for ECDSA signing methods +* Added support for RSA PSS signing methods (requires go v1.4) + +#### 2.2.0 + +* Gracefully handle a `nil` `Keyfunc` being passed to `Parse`. Result will now be the parsed token and an error, instead of a panic. + +#### 2.1.0 + +Backwards compatible API change that was missed in 2.0.0. + +* The `SignedString` method on `Token` now takes `interface{}` instead of `[]byte` + +#### 2.0.0 + +There were two major reasons for breaking backwards compatibility with this update. The first was a refactor required to expand the width of the RSA and HMAC-SHA signing implementations. There will likely be no required code changes to support this change. + +The second update, while unfortunately requiring a small change in integration, is required to open up this library to other signing methods. Not all keys used for all signing methods have a single standard on-disk representation. Requiring `[]byte` as the type for all keys proved too limiting. Additionally, this implementation allows for pre-parsed tokens to be reused, which might matter in an application that parses a high volume of tokens with a small set of keys. Backwards compatibilty has been maintained for passing `[]byte` to the RSA signing methods, but they will also accept `*rsa.PublicKey` and `*rsa.PrivateKey`. + +It is likely the only integration change required here will be to change `func(t *jwt.Token) ([]byte, error)` to `func(t *jwt.Token) (interface{}, error)` when calling `Parse`. + +* **Compatibility Breaking Changes** + * `SigningMethodHS256` is now `*SigningMethodHMAC` instead of `type struct` + * `SigningMethodRS256` is now `*SigningMethodRSA` instead of `type struct` + * `KeyFunc` now returns `interface{}` instead of `[]byte` + * `SigningMethod.Sign` now takes `interface{}` instead of `[]byte` for the key + * `SigningMethod.Verify` now takes `interface{}` instead of `[]byte` for the key +* Renamed type `SigningMethodHS256` to `SigningMethodHMAC`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodHS256` + * Added public package global `SigningMethodHS384` + * Added public package global `SigningMethodHS512` +* Renamed type `SigningMethodRS256` to `SigningMethodRSA`. Specific sizes are now just instances of this type. + * Added public package global `SigningMethodRS256` + * Added public package global `SigningMethodRS384` + * Added public package global `SigningMethodRS512` +* Moved sample private key for HMAC tests from an inline value to a file on disk. Value is unchanged. +* Refactored the RSA implementation to be easier to read +* Exposed helper methods `ParseRSAPrivateKeyFromPEM` and `ParseRSAPublicKeyFromPEM` + +## 1.0.2 + +* Fixed bug in parsing public keys from certificates +* Added more tests around the parsing of keys for RS256 +* Code refactoring in RS256 implementation. No functional changes + +## 1.0.1 + +* Fixed panic if RS256 signing method was passed an invalid key + +## 1.0.0 + +* First versioned release +* API stabilized +* Supports creating, signing, parsing, and validating JWT tokens +* Supports RS256 and HS256 signing methods diff --git a/vendor/github.com/golang-jwt/jwt/v5/claims.go b/vendor/github.com/golang-jwt/jwt/v5/claims.go new file mode 100644 index 00000000..d50ff3da --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/claims.go @@ -0,0 +1,16 @@ +package jwt + +// Claims represent any form of a JWT Claims Set according to +// https://datatracker.ietf.org/doc/html/rfc7519#section-4. In order to have a +// common basis for validation, it is required that an implementation is able to +// supply at least the claim names provided in +// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 namely `exp`, +// `iat`, `nbf`, `iss`, `sub` and `aud`. +type Claims interface { + GetExpirationTime() (*NumericDate, error) + GetIssuedAt() (*NumericDate, error) + GetNotBefore() (*NumericDate, error) + GetIssuer() (string, error) + GetSubject() (string, error) + GetAudience() (ClaimStrings, error) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/doc.go b/vendor/github.com/golang-jwt/jwt/v5/doc.go new file mode 100644 index 00000000..a86dc1a3 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/doc.go @@ -0,0 +1,4 @@ +// Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html +// +// See README.md for more info. +package jwt diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go new file mode 100644 index 00000000..06cd94d2 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ecdsa.go @@ -0,0 +1,134 @@ +package jwt + +import ( + "crypto" + "crypto/ecdsa" + "crypto/rand" + "errors" + "math/big" +) + +var ( + // Sadly this is missing from crypto/ecdsa compared to crypto/rsa + ErrECDSAVerification = errors.New("crypto/ecdsa: verification error") +) + +// SigningMethodECDSA implements the ECDSA family of signing methods. +// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification +type SigningMethodECDSA struct { + Name string + Hash crypto.Hash + KeySize int + CurveBits int +} + +// Specific instances for EC256 and company +var ( + SigningMethodES256 *SigningMethodECDSA + SigningMethodES384 *SigningMethodECDSA + SigningMethodES512 *SigningMethodECDSA +) + +func init() { + // ES256 + SigningMethodES256 = &SigningMethodECDSA{"ES256", crypto.SHA256, 32, 256} + RegisterSigningMethod(SigningMethodES256.Alg(), func() SigningMethod { + return SigningMethodES256 + }) + + // ES384 + SigningMethodES384 = &SigningMethodECDSA{"ES384", crypto.SHA384, 48, 384} + RegisterSigningMethod(SigningMethodES384.Alg(), func() SigningMethod { + return SigningMethodES384 + }) + + // ES512 + SigningMethodES512 = &SigningMethodECDSA{"ES512", crypto.SHA512, 66, 521} + RegisterSigningMethod(SigningMethodES512.Alg(), func() SigningMethod { + return SigningMethodES512 + }) +} + +func (m *SigningMethodECDSA) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an ecdsa.PublicKey struct +func (m *SigningMethodECDSA) Verify(signingString string, sig []byte, key any) error { + // Get the key + var ecdsaKey *ecdsa.PublicKey + switch k := key.(type) { + case *ecdsa.PublicKey: + ecdsaKey = k + default: + return newError("ECDSA verify expects *ecdsa.PublicKey", ErrInvalidKeyType) + } + + if len(sig) != 2*m.KeySize { + return ErrECDSAVerification + } + + r := big.NewInt(0).SetBytes(sig[:m.KeySize]) + s := big.NewInt(0).SetBytes(sig[m.KeySize:]) + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + if verifystatus := ecdsa.Verify(ecdsaKey, hasher.Sum(nil), r, s); verifystatus { + return nil + } + + return ErrECDSAVerification +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an ecdsa.PrivateKey struct +func (m *SigningMethodECDSA) Sign(signingString string, key any) ([]byte, error) { + // Get the key + var ecdsaKey *ecdsa.PrivateKey + switch k := key.(type) { + case *ecdsa.PrivateKey: + ecdsaKey = k + default: + return nil, newError("ECDSA sign expects *ecdsa.PrivateKey", ErrInvalidKeyType) + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return r, s + if r, s, err := ecdsa.Sign(rand.Reader, ecdsaKey, hasher.Sum(nil)); err == nil { + curveBits := ecdsaKey.Curve.Params().BitSize + + if m.CurveBits != curveBits { + return nil, ErrInvalidKey + } + + keyBytes := curveBits / 8 + if curveBits%8 > 0 { + keyBytes += 1 + } + + // We serialize the outputs (r and s) into big-endian byte arrays + // padded with zeros on the left to make sure the sizes work out. + // Output must be 2*keyBytes long. + out := make([]byte, 2*keyBytes) + r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output. + s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output. + + return out, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go new file mode 100644 index 00000000..44a3b7a1 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ecdsa_utils.go @@ -0,0 +1,69 @@ +package jwt + +import ( + "crypto/ecdsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotECPublicKey = errors.New("key is not a valid ECDSA public key") + ErrNotECPrivateKey = errors.New("key is not a valid ECDSA private key") +) + +// ParseECPrivateKeyFromPEM parses a PEM encoded Elliptic Curve Private Key Structure +func ParseECPrivateKeyFromPEM(key []byte) (*ecdsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParseECPrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *ecdsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PrivateKey); !ok { + return nil, ErrNotECPrivateKey + } + + return pkey, nil +} + +// ParseECPublicKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 public key +func ParseECPublicKeyFromPEM(key []byte) (*ecdsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + return nil, err + } + } + + var pkey *ecdsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*ecdsa.PublicKey); !ok { + return nil, ErrNotECPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go new file mode 100644 index 00000000..4159e57b --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ed25519.go @@ -0,0 +1,79 @@ +package jwt + +import ( + "crypto" + "crypto/ed25519" + "crypto/rand" + "errors" +) + +var ( + ErrEd25519Verification = errors.New("ed25519: verification error") +) + +// SigningMethodEd25519 implements the EdDSA family. +// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification +type SigningMethodEd25519 struct{} + +// Specific instance for EdDSA +var ( + SigningMethodEdDSA *SigningMethodEd25519 +) + +func init() { + SigningMethodEdDSA = &SigningMethodEd25519{} + RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod { + return SigningMethodEdDSA + }) +} + +func (m *SigningMethodEd25519) Alg() string { + return "EdDSA" +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an ed25519.PublicKey +func (m *SigningMethodEd25519) Verify(signingString string, sig []byte, key any) error { + var ed25519Key ed25519.PublicKey + var ok bool + + if ed25519Key, ok = key.(ed25519.PublicKey); !ok { + return newError("Ed25519 verify expects ed25519.PublicKey", ErrInvalidKeyType) + } + + if len(ed25519Key) != ed25519.PublicKeySize { + return ErrInvalidKey + } + + // Verify the signature + if !ed25519.Verify(ed25519Key, []byte(signingString), sig) { + return ErrEd25519Verification + } + + return nil +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an ed25519.PrivateKey +func (m *SigningMethodEd25519) Sign(signingString string, key any) ([]byte, error) { + var ed25519Key crypto.Signer + var ok bool + + if ed25519Key, ok = key.(crypto.Signer); !ok { + return nil, newError("Ed25519 sign expects crypto.Signer", ErrInvalidKeyType) + } + + if _, ok := ed25519Key.Public().(ed25519.PublicKey); !ok { + return nil, ErrInvalidKey + } + + // Sign the string and return the result. ed25519 performs a two-pass hash + // as part of its algorithm. Therefore, we need to pass a non-prehashed + // message into the Sign function, as indicated by crypto.Hash(0) + sig, err := ed25519Key.Sign(rand.Reader, []byte(signingString), crypto.Hash(0)) + if err != nil { + return nil, err + } + + return sig, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go new file mode 100644 index 00000000..6f46e886 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/ed25519_utils.go @@ -0,0 +1,64 @@ +package jwt + +import ( + "crypto" + "crypto/ed25519" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotEdPrivateKey = errors.New("key is not a valid Ed25519 private key") + ErrNotEdPublicKey = errors.New("key is not a valid Ed25519 public key") +) + +// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key +func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PrivateKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok { + return nil, ErrNotEdPrivateKey + } + + return pkey, nil +} + +// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key +func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PublicKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PublicKey); !ok { + return nil, ErrNotEdPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/errors.go b/vendor/github.com/golang-jwt/jwt/v5/errors.go new file mode 100644 index 00000000..14e00751 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/errors.go @@ -0,0 +1,89 @@ +package jwt + +import ( + "errors" + "fmt" + "strings" +) + +var ( + ErrInvalidKey = errors.New("key is invalid") + ErrInvalidKeyType = errors.New("key is of invalid type") + ErrHashUnavailable = errors.New("the requested hash function is unavailable") + ErrTokenMalformed = errors.New("token is malformed") + ErrTokenUnverifiable = errors.New("token is unverifiable") + ErrTokenSignatureInvalid = errors.New("token signature is invalid") + ErrTokenRequiredClaimMissing = errors.New("token is missing required claim") + ErrTokenInvalidAudience = errors.New("token has invalid audience") + ErrTokenExpired = errors.New("token is expired") + ErrTokenUsedBeforeIssued = errors.New("token used before issued") + ErrTokenInvalidIssuer = errors.New("token has invalid issuer") + ErrTokenInvalidSubject = errors.New("token has invalid subject") + ErrTokenNotValidYet = errors.New("token is not valid yet") + ErrTokenInvalidId = errors.New("token has invalid id") + ErrTokenInvalidClaims = errors.New("token has invalid claims") + ErrInvalidType = errors.New("invalid type for claim") +) + +// joinedError is an error type that works similar to what [errors.Join] +// produces, with the exception that it has a nice error string; mainly its +// error messages are concatenated using a comma, rather than a newline. +type joinedError struct { + errs []error +} + +func (je joinedError) Error() string { + msg := []string{} + for _, err := range je.errs { + msg = append(msg, err.Error()) + } + + return strings.Join(msg, ", ") +} + +// joinErrors joins together multiple errors. Useful for scenarios where +// multiple errors next to each other occur, e.g., in claims validation. +func joinErrors(errs ...error) error { + return &joinedError{ + errs: errs, + } +} + +// Unwrap implements the multiple error unwrapping for this error type, which is +// possible in Go 1.20. +func (je joinedError) Unwrap() []error { + return je.errs +} + +// newError creates a new error message with a detailed error message. The +// message will be prefixed with the contents of the supplied error type. +// Additionally, more errors, that provide more context can be supplied which +// will be appended to the message. This makes use of Go 1.20's possibility to +// include more than one %w formatting directive in [fmt.Errorf]. +// +// For example, +// +// newError("no keyfunc was provided", ErrTokenUnverifiable) +// +// will produce the error string +// +// "token is unverifiable: no keyfunc was provided" +func newError(message string, err error, more ...error) error { + var format string + var args []any + if message != "" { + format = "%w: %s" + args = []any{err, message} + } else { + format = "%w" + args = []any{err} + } + + for _, e := range more { + format += ": %w" + args = append(args, e) + } + + err = fmt.Errorf(format, args...) + return err +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/hmac.go b/vendor/github.com/golang-jwt/jwt/v5/hmac.go new file mode 100644 index 00000000..1bef138c --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/hmac.go @@ -0,0 +1,104 @@ +package jwt + +import ( + "crypto" + "crypto/hmac" + "errors" +) + +// SigningMethodHMAC implements the HMAC-SHA family of signing methods. +// Expects key type of []byte for both signing and validation +type SigningMethodHMAC struct { + Name string + Hash crypto.Hash +} + +// Specific instances for HS256 and company +var ( + SigningMethodHS256 *SigningMethodHMAC + SigningMethodHS384 *SigningMethodHMAC + SigningMethodHS512 *SigningMethodHMAC + ErrSignatureInvalid = errors.New("signature is invalid") +) + +func init() { + // HS256 + SigningMethodHS256 = &SigningMethodHMAC{"HS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodHS256.Alg(), func() SigningMethod { + return SigningMethodHS256 + }) + + // HS384 + SigningMethodHS384 = &SigningMethodHMAC{"HS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodHS384.Alg(), func() SigningMethod { + return SigningMethodHS384 + }) + + // HS512 + SigningMethodHS512 = &SigningMethodHMAC{"HS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodHS512.Alg(), func() SigningMethod { + return SigningMethodHS512 + }) +} + +func (m *SigningMethodHMAC) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod. Returns nil if +// the signature is valid. Key must be []byte. +// +// Note it is not advised to provide a []byte which was converted from a 'human +// readable' string using a subset of ASCII characters. To maximize entropy, you +// should ideally be providing a []byte key which was produced from a +// cryptographically random source, e.g. crypto/rand. Additional information +// about this, and why we intentionally are not supporting string as a key can +// be found on our usage guide +// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types. +func (m *SigningMethodHMAC) Verify(signingString string, sig []byte, key any) error { + // Verify the key is the right type + keyBytes, ok := key.([]byte) + if !ok { + return newError("HMAC verify expects []byte", ErrInvalidKeyType) + } + + // Can we use the specified hashing method? + if !m.Hash.Available() { + return ErrHashUnavailable + } + + // This signing method is symmetric, so we validate the signature + // by reproducing the signature from the signing string and key, then + // comparing that against the provided signature. + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + if !hmac.Equal(sig, hasher.Sum(nil)) { + return ErrSignatureInvalid + } + + // No validation errors. Signature is good. + return nil +} + +// Sign implements token signing for the SigningMethod. Key must be []byte. +// +// Note it is not advised to provide a []byte which was converted from a 'human +// readable' string using a subset of ASCII characters. To maximize entropy, you +// should ideally be providing a []byte key which was produced from a +// cryptographically random source, e.g. crypto/rand. Additional information +// about this, and why we intentionally are not supporting string as a key can +// be found on our usage guide https://golang-jwt.github.io/jwt/usage/signing_methods/. +func (m *SigningMethodHMAC) Sign(signingString string, key any) ([]byte, error) { + if keyBytes, ok := key.([]byte); ok { + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := hmac.New(m.Hash.New, keyBytes) + hasher.Write([]byte(signingString)) + + return hasher.Sum(nil), nil + } + + return nil, newError("HMAC sign expects []byte", ErrInvalidKeyType) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/map_claims.go b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go new file mode 100644 index 00000000..3b920527 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/map_claims.go @@ -0,0 +1,109 @@ +package jwt + +import ( + "encoding/json" + "fmt" +) + +// MapClaims is a claims type that uses the map[string]any for JSON +// decoding. This is the default claims type if you don't supply one +type MapClaims map[string]any + +// GetExpirationTime implements the Claims interface. +func (m MapClaims) GetExpirationTime() (*NumericDate, error) { + return m.parseNumericDate("exp") +} + +// GetNotBefore implements the Claims interface. +func (m MapClaims) GetNotBefore() (*NumericDate, error) { + return m.parseNumericDate("nbf") +} + +// GetIssuedAt implements the Claims interface. +func (m MapClaims) GetIssuedAt() (*NumericDate, error) { + return m.parseNumericDate("iat") +} + +// GetAudience implements the Claims interface. +func (m MapClaims) GetAudience() (ClaimStrings, error) { + return m.parseClaimsString("aud") +} + +// GetIssuer implements the Claims interface. +func (m MapClaims) GetIssuer() (string, error) { + return m.parseString("iss") +} + +// GetSubject implements the Claims interface. +func (m MapClaims) GetSubject() (string, error) { + return m.parseString("sub") +} + +// parseNumericDate tries to parse a key in the map claims type as a number +// date. This will succeed, if the underlying type is either a [float64] or a +// [json.Number]. Otherwise, nil will be returned. +func (m MapClaims) parseNumericDate(key string) (*NumericDate, error) { + v, ok := m[key] + if !ok { + return nil, nil + } + + switch exp := v.(type) { + case float64: + if exp == 0 { + return nil, nil + } + + return newNumericDateFromSeconds(exp), nil + case json.Number: + v, _ := exp.Float64() + + return newNumericDateFromSeconds(v), nil + } + + return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) +} + +// parseClaimsString tries to parse a key in the map claims type as a +// [ClaimsStrings] type, which can either be a string or an array of string. +func (m MapClaims) parseClaimsString(key string) (ClaimStrings, error) { + var cs []string + switch v := m[key].(type) { + case string: + cs = append(cs, v) + case []string: + cs = v + case []any: + for _, a := range v { + vs, ok := a.(string) + if !ok { + return nil, newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) + } + cs = append(cs, vs) + } + } + + return cs, nil +} + +// parseString tries to parse a key in the map claims type as a [string] type. +// If the key does not exist, an empty string is returned. If the key has the +// wrong type, an error is returned. +func (m MapClaims) parseString(key string) (string, error) { + var ( + ok bool + raw any + iss string + ) + raw, ok = m[key] + if !ok { + return "", nil + } + + iss, ok = raw.(string) + if !ok { + return "", newError(fmt.Sprintf("%s is invalid", key), ErrInvalidType) + } + + return iss, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/none.go b/vendor/github.com/golang-jwt/jwt/v5/none.go new file mode 100644 index 00000000..624ad55e --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/none.go @@ -0,0 +1,50 @@ +package jwt + +// SigningMethodNone implements the none signing method. This is required by the spec +// but you probably should never use it. +var SigningMethodNone *signingMethodNone + +const UnsafeAllowNoneSignatureType unsafeNoneMagicConstant = "none signing method allowed" + +var NoneSignatureTypeDisallowedError error + +type signingMethodNone struct{} +type unsafeNoneMagicConstant string + +func init() { + SigningMethodNone = &signingMethodNone{} + NoneSignatureTypeDisallowedError = newError("'none' signature type is not allowed", ErrTokenUnverifiable) + + RegisterSigningMethod(SigningMethodNone.Alg(), func() SigningMethod { + return SigningMethodNone + }) +} + +func (m *signingMethodNone) Alg() string { + return "none" +} + +// Only allow 'none' alg type if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Verify(signingString string, sig []byte, key any) (err error) { + // Key must be UnsafeAllowNoneSignatureType to prevent accidentally + // accepting 'none' signing method + if _, ok := key.(unsafeNoneMagicConstant); !ok { + return NoneSignatureTypeDisallowedError + } + // If signing method is none, signature must be an empty string + if len(sig) != 0 { + return newError("'none' signing method with non-empty signature", ErrTokenUnverifiable) + } + + // Accept 'none' signing method. + return nil +} + +// Only allow 'none' signing if UnsafeAllowNoneSignatureType is specified as the key +func (m *signingMethodNone) Sign(signingString string, key any) ([]byte, error) { + if _, ok := key.(unsafeNoneMagicConstant); ok { + return []byte{}, nil + } + + return nil, NoneSignatureTypeDisallowedError +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser.go b/vendor/github.com/golang-jwt/jwt/v5/parser.go new file mode 100644 index 00000000..054c7eb6 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/parser.go @@ -0,0 +1,268 @@ +package jwt + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "fmt" + "strings" +) + +const tokenDelimiter = "." + +type Parser struct { + // If populated, only these methods will be considered valid. + validMethods []string + + // Use JSON Number format in JSON decoder. + useJSONNumber bool + + // Skip claims validation during token parsing. + skipClaimsValidation bool + + validator *Validator + + decodeStrict bool + + decodePaddingAllowed bool +} + +// NewParser creates a new Parser with the specified options +func NewParser(options ...ParserOption) *Parser { + p := &Parser{ + validator: &Validator{}, + } + + // Loop through our parsing options and apply them + for _, option := range options { + option(p) + } + + return p +} + +// Parse parses, validates, verifies the signature and returns the parsed token. +// keyFunc will receive the parsed token and should return the key for validating. +func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { + return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) +} + +// ParseWithClaims parses, validates, and verifies like Parse, but supplies a default object implementing the Claims +// interface. This provides default values which can be overridden and allows a caller to use their own type, rather +// than the default MapClaims implementation of Claims. +// +// Note: If you provide a custom claim implementation that embeds one of the standard claims (such as RegisteredClaims), +// make sure that a) you either embed a non-pointer version of the claims or b) if you are using a pointer, allocate the +// proper memory for it before passing in the overall claims, otherwise you might run into a panic. +func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { + token, parts, err := p.ParseUnverified(tokenString, claims) + if err != nil { + return token, err + } + + // Verify signing method is in the required set + if p.validMethods != nil { + var signingMethodValid = false + var alg = token.Method.Alg() + for _, m := range p.validMethods { + if m == alg { + signingMethodValid = true + break + } + } + if !signingMethodValid { + // signing method is not in the listed set + return token, newError(fmt.Sprintf("signing method %v is invalid", alg), ErrTokenSignatureInvalid) + } + } + + // Decode signature + token.Signature, err = p.DecodeSegment(parts[2]) + if err != nil { + return token, newError("could not base64 decode signature", ErrTokenMalformed, err) + } + text := strings.Join(parts[0:2], ".") + + // Lookup key(s) + if keyFunc == nil { + // keyFunc was not provided. short circuiting validation + return token, newError("no keyfunc was provided", ErrTokenUnverifiable) + } + + got, err := keyFunc(token) + if err != nil { + return token, newError("error while executing keyfunc", ErrTokenUnverifiable, err) + } + + switch have := got.(type) { + case VerificationKeySet: + if len(have.Keys) == 0 { + return token, newError("keyfunc returned empty verification key set", ErrTokenUnverifiable) + } + // Iterate through keys and verify signature, skipping the rest when a match is found. + // Return the last error if no match is found. + for _, key := range have.Keys { + if err = token.Method.Verify(text, token.Signature, key); err == nil { + break + } + } + default: + err = token.Method.Verify(text, token.Signature, have) + } + if err != nil { + return token, newError("", ErrTokenSignatureInvalid, err) + } + + // Validate Claims + if !p.skipClaimsValidation { + // Make sure we have at least a default validator + if p.validator == nil { + p.validator = NewValidator() + } + + if err := p.validator.Validate(claims); err != nil { + return token, newError("", ErrTokenInvalidClaims, err) + } + } + + // No errors so far, token is valid. + token.Valid = true + + return token, nil +} + +// ParseUnverified parses the token but doesn't validate the signature. +// +// WARNING: Don't use this method unless you know what you're doing. +// +// It's only ever useful in cases where you know the signature is valid (since it has already +// been or will be checked elsewhere in the stack) and you want to extract values from it. +func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) { + var ok bool + parts, ok = splitToken(tokenString) + if !ok { + return nil, nil, newError("token contains an invalid number of segments", ErrTokenMalformed) + } + + token = &Token{Raw: tokenString} + + // parse Header + var headerBytes []byte + if headerBytes, err = p.DecodeSegment(parts[0]); err != nil { + return token, parts, newError("could not base64 decode header", ErrTokenMalformed, err) + } + if err = json.Unmarshal(headerBytes, &token.Header); err != nil { + return token, parts, newError("could not JSON decode header", ErrTokenMalformed, err) + } + + // parse Claims + token.Claims = claims + + claimBytes, err := p.DecodeSegment(parts[1]) + if err != nil { + return token, parts, newError("could not base64 decode claim", ErrTokenMalformed, err) + } + + // If `useJSONNumber` is enabled then we must use *json.Decoder to decode + // the claims. However, this comes with a performance penalty so only use + // it if we must and, otherwise, simple use json.Unmarshal. + if !p.useJSONNumber { + // JSON Unmarshal. Special case for map type to avoid weird pointer behavior. + if c, ok := token.Claims.(MapClaims); ok { + err = json.Unmarshal(claimBytes, &c) + } else { + err = json.Unmarshal(claimBytes, &claims) + } + } else { + dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) + dec.UseNumber() + // JSON Decode. Special case for map type to avoid weird pointer behavior. + if c, ok := token.Claims.(MapClaims); ok { + err = dec.Decode(&c) + } else { + err = dec.Decode(&claims) + } + } + if err != nil { + return token, parts, newError("could not JSON decode claim", ErrTokenMalformed, err) + } + + // Lookup signature method + if method, ok := token.Header["alg"].(string); ok { + if token.Method = GetSigningMethod(method); token.Method == nil { + return token, parts, newError("signing method (alg) is unavailable", ErrTokenUnverifiable) + } + } else { + return token, parts, newError("signing method (alg) is unspecified", ErrTokenUnverifiable) + } + + return token, parts, nil +} + +// splitToken splits a token string into three parts: header, claims, and signature. It will only +// return true if the token contains exactly two delimiters and three parts. In all other cases, it +// will return nil parts and false. +func splitToken(token string) ([]string, bool) { + parts := make([]string, 3) + header, remain, ok := strings.Cut(token, tokenDelimiter) + if !ok { + return nil, false + } + parts[0] = header + claims, remain, ok := strings.Cut(remain, tokenDelimiter) + if !ok { + return nil, false + } + parts[1] = claims + // One more cut to ensure the signature is the last part of the token and there are no more + // delimiters. This avoids an issue where malicious input could contain additional delimiters + // causing unecessary overhead parsing tokens. + signature, _, unexpected := strings.Cut(remain, tokenDelimiter) + if unexpected { + return nil, false + } + parts[2] = signature + + return parts, true +} + +// DecodeSegment decodes a JWT specific base64url encoding. This function will +// take into account whether the [Parser] is configured with additional options, +// such as [WithStrictDecoding] or [WithPaddingAllowed]. +func (p *Parser) DecodeSegment(seg string) ([]byte, error) { + encoding := base64.RawURLEncoding + + if p.decodePaddingAllowed { + if l := len(seg) % 4; l > 0 { + seg += strings.Repeat("=", 4-l) + } + encoding = base64.URLEncoding + } + + if p.decodeStrict { + encoding = encoding.Strict() + } + return encoding.DecodeString(seg) +} + +// Parse parses, validates, verifies the signature and returns the parsed token. +// keyFunc will receive the parsed token and should return the cryptographic key +// for verifying the signature. The caller is strongly encouraged to set the +// WithValidMethods option to validate the 'alg' claim in the token matches the +// expected algorithm. For more details about the importance of validating the +// 'alg' claim, see +// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/ +func Parse(tokenString string, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { + return NewParser(options...).Parse(tokenString, keyFunc) +} + +// ParseWithClaims is a shortcut for NewParser().ParseWithClaims(). +// +// Note: If you provide a custom claim implementation that embeds one of the +// standard claims (such as RegisteredClaims), make sure that a) you either +// embed a non-pointer version of the claims or b) if you are using a pointer, +// allocate the proper memory for it before passing in the overall claims, +// otherwise you might run into a panic. +func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc, options ...ParserOption) (*Token, error) { + return NewParser(options...).ParseWithClaims(tokenString, claims, keyFunc) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/parser_option.go b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go new file mode 100644 index 00000000..43157355 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/parser_option.go @@ -0,0 +1,145 @@ +package jwt + +import "time" + +// ParserOption is used to implement functional-style options that modify the +// behavior of the parser. To add new options, just create a function (ideally +// beginning with With or Without) that returns an anonymous function that takes +// a *Parser type as input and manipulates its configuration accordingly. +type ParserOption func(*Parser) + +// WithValidMethods is an option to supply algorithm methods that the parser +// will check. Only those methods will be considered valid. It is heavily +// encouraged to use this option in order to prevent attacks such as +// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/. +func WithValidMethods(methods []string) ParserOption { + return func(p *Parser) { + p.validMethods = methods + } +} + +// WithJSONNumber is an option to configure the underlying JSON parser with +// UseNumber. +func WithJSONNumber() ParserOption { + return func(p *Parser) { + p.useJSONNumber = true + } +} + +// WithoutClaimsValidation is an option to disable claims validation. This +// option should only be used if you exactly know what you are doing. +func WithoutClaimsValidation() ParserOption { + return func(p *Parser) { + p.skipClaimsValidation = true + } +} + +// WithLeeway returns the ParserOption for specifying the leeway window. +func WithLeeway(leeway time.Duration) ParserOption { + return func(p *Parser) { + p.validator.leeway = leeway + } +} + +// WithTimeFunc returns the ParserOption for specifying the time func. The +// primary use-case for this is testing. If you are looking for a way to account +// for clock-skew, WithLeeway should be used instead. +func WithTimeFunc(f func() time.Time) ParserOption { + return func(p *Parser) { + p.validator.timeFunc = f + } +} + +// WithIssuedAt returns the ParserOption to enable verification +// of issued-at. +func WithIssuedAt() ParserOption { + return func(p *Parser) { + p.validator.verifyIat = true + } +} + +// WithExpirationRequired returns the ParserOption to make exp claim required. +// By default exp claim is optional. +func WithExpirationRequired() ParserOption { + return func(p *Parser) { + p.validator.requireExp = true + } +} + +// WithAudience configures the validator to require any of the specified +// audiences in the `aud` claim. Validation will fail if the audience is not +// listed in the token or the `aud` claim is missing. +// +// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an audience is expected. +func WithAudience(aud ...string) ParserOption { + return func(p *Parser) { + p.validator.expectedAud = aud + } +} + +// WithAllAudiences configures the validator to require all the specified +// audiences in the `aud` claim. Validation will fail if the specified audiences +// are not listed in the token or the `aud` claim is missing. Duplicates within +// the list are de-duplicated since internally, we use a map to look up the +// audiences. +// +// NOTE: While the `aud` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an audience is expected. +func WithAllAudiences(aud ...string) ParserOption { + return func(p *Parser) { + p.validator.expectedAud = aud + p.validator.expectAllAud = true + } +} + +// WithIssuer configures the validator to require the specified issuer in the +// `iss` claim. Validation will fail if a different issuer is specified in the +// token or the `iss` claim is missing. +// +// NOTE: While the `iss` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if an issuer is expected. +func WithIssuer(iss string) ParserOption { + return func(p *Parser) { + p.validator.expectedIss = iss + } +} + +// WithSubject configures the validator to require the specified subject in the +// `sub` claim. Validation will fail if a different subject is specified in the +// token or the `sub` claim is missing. +// +// NOTE: While the `sub` claim is OPTIONAL in a JWT, the handling of it is +// application-specific. Since this validation API is helping developers in +// writing secure application, we decided to REQUIRE the existence of the claim, +// if a subject is expected. +func WithSubject(sub string) ParserOption { + return func(p *Parser) { + p.validator.expectedSub = sub + } +} + +// WithPaddingAllowed will enable the codec used for decoding JWTs to allow +// padding. Note that the JWS RFC7515 states that the tokens will utilize a +// Base64url encoding with no padding. Unfortunately, some implementations of +// JWT are producing non-standard tokens, and thus require support for decoding. +func WithPaddingAllowed() ParserOption { + return func(p *Parser) { + p.decodePaddingAllowed = true + } +} + +// WithStrictDecoding will switch the codec used for decoding JWTs into strict +// mode. In this mode, the decoder requires that trailing padding bits are zero, +// as described in RFC 4648 section 3.5. +func WithStrictDecoding() ParserOption { + return func(p *Parser) { + p.decodeStrict = true + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go new file mode 100644 index 00000000..77951a53 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/registered_claims.go @@ -0,0 +1,63 @@ +package jwt + +// RegisteredClaims are a structured version of the JWT Claims Set, +// restricted to Registered Claim Names, as referenced at +// https://datatracker.ietf.org/doc/html/rfc7519#section-4.1 +// +// This type can be used on its own, but then additional private and +// public claims embedded in the JWT will not be parsed. The typical use-case +// therefore is to embedded this in a user-defined claim type. +// +// See examples for how to use this with your own claim types. +type RegisteredClaims struct { + // the `iss` (Issuer) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.1 + Issuer string `json:"iss,omitempty"` + + // the `sub` (Subject) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.2 + Subject string `json:"sub,omitempty"` + + // the `aud` (Audience) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3 + Audience ClaimStrings `json:"aud,omitempty"` + + // the `exp` (Expiration Time) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.4 + ExpiresAt *NumericDate `json:"exp,omitempty"` + + // the `nbf` (Not Before) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.5 + NotBefore *NumericDate `json:"nbf,omitempty"` + + // the `iat` (Issued At) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.6 + IssuedAt *NumericDate `json:"iat,omitempty"` + + // the `jti` (JWT ID) claim. See https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.7 + ID string `json:"jti,omitempty"` +} + +// GetExpirationTime implements the Claims interface. +func (c RegisteredClaims) GetExpirationTime() (*NumericDate, error) { + return c.ExpiresAt, nil +} + +// GetNotBefore implements the Claims interface. +func (c RegisteredClaims) GetNotBefore() (*NumericDate, error) { + return c.NotBefore, nil +} + +// GetIssuedAt implements the Claims interface. +func (c RegisteredClaims) GetIssuedAt() (*NumericDate, error) { + return c.IssuedAt, nil +} + +// GetAudience implements the Claims interface. +func (c RegisteredClaims) GetAudience() (ClaimStrings, error) { + return c.Audience, nil +} + +// GetIssuer implements the Claims interface. +func (c RegisteredClaims) GetIssuer() (string, error) { + return c.Issuer, nil +} + +// GetSubject implements the Claims interface. +func (c RegisteredClaims) GetSubject() (string, error) { + return c.Subject, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa.go b/vendor/github.com/golang-jwt/jwt/v5/rsa.go new file mode 100644 index 00000000..98b960a7 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa.go @@ -0,0 +1,93 @@ +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// SigningMethodRSA implements the RSA family of signing methods. +// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation +type SigningMethodRSA struct { + Name string + Hash crypto.Hash +} + +// Specific instances for RS256 and company +var ( + SigningMethodRS256 *SigningMethodRSA + SigningMethodRS384 *SigningMethodRSA + SigningMethodRS512 *SigningMethodRSA +) + +func init() { + // RS256 + SigningMethodRS256 = &SigningMethodRSA{"RS256", crypto.SHA256} + RegisterSigningMethod(SigningMethodRS256.Alg(), func() SigningMethod { + return SigningMethodRS256 + }) + + // RS384 + SigningMethodRS384 = &SigningMethodRSA{"RS384", crypto.SHA384} + RegisterSigningMethod(SigningMethodRS384.Alg(), func() SigningMethod { + return SigningMethodRS384 + }) + + // RS512 + SigningMethodRS512 = &SigningMethodRSA{"RS512", crypto.SHA512} + RegisterSigningMethod(SigningMethodRS512.Alg(), func() SigningMethod { + return SigningMethodRS512 + }) +} + +func (m *SigningMethodRSA) Alg() string { + return m.Name +} + +// Verify implements token verification for the SigningMethod +// For this signing method, must be an *rsa.PublicKey structure. +func (m *SigningMethodRSA) Verify(signingString string, sig []byte, key any) error { + var rsaKey *rsa.PublicKey + var ok bool + + if rsaKey, ok = key.(*rsa.PublicKey); !ok { + return newError("RSA verify expects *rsa.PublicKey", ErrInvalidKeyType) + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Verify the signature + return rsa.VerifyPKCS1v15(rsaKey, m.Hash, hasher.Sum(nil), sig) +} + +// Sign implements token signing for the SigningMethod +// For this signing method, must be an *rsa.PrivateKey structure. +func (m *SigningMethodRSA) Sign(signingString string, key any) ([]byte, error) { + var rsaKey *rsa.PrivateKey + var ok bool + + // Validate type of key + if rsaKey, ok = key.(*rsa.PrivateKey); !ok { + return nil, newError("RSA sign expects *rsa.PrivateKey", ErrInvalidKeyType) + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil)); err == nil { + return sigBytes, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go new file mode 100644 index 00000000..f17590cc --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa_pss.go @@ -0,0 +1,132 @@ +package jwt + +import ( + "crypto" + "crypto/rand" + "crypto/rsa" +) + +// SigningMethodRSAPSS implements the RSAPSS family of signing methods signing methods +type SigningMethodRSAPSS struct { + *SigningMethodRSA + Options *rsa.PSSOptions + // VerifyOptions is optional. If set overrides Options for rsa.VerifyPPS. + // Used to accept tokens signed with rsa.PSSSaltLengthAuto, what doesn't follow + // https://tools.ietf.org/html/rfc7518#section-3.5 but was used previously. + // See https://github.com/dgrijalva/jwt-go/issues/285#issuecomment-437451244 for details. + VerifyOptions *rsa.PSSOptions +} + +// Specific instances for RS/PS and company. +var ( + SigningMethodPS256 *SigningMethodRSAPSS + SigningMethodPS384 *SigningMethodRSAPSS + SigningMethodPS512 *SigningMethodRSAPSS +) + +func init() { + // PS256 + SigningMethodPS256 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS256", + Hash: crypto.SHA256, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS256.Alg(), func() SigningMethod { + return SigningMethodPS256 + }) + + // PS384 + SigningMethodPS384 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS384", + Hash: crypto.SHA384, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS384.Alg(), func() SigningMethod { + return SigningMethodPS384 + }) + + // PS512 + SigningMethodPS512 = &SigningMethodRSAPSS{ + SigningMethodRSA: &SigningMethodRSA{ + Name: "PS512", + Hash: crypto.SHA512, + }, + Options: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthEqualsHash, + }, + VerifyOptions: &rsa.PSSOptions{ + SaltLength: rsa.PSSSaltLengthAuto, + }, + } + RegisterSigningMethod(SigningMethodPS512.Alg(), func() SigningMethod { + return SigningMethodPS512 + }) +} + +// Verify implements token verification for the SigningMethod. +// For this verify method, key must be an rsa.PublicKey struct +func (m *SigningMethodRSAPSS) Verify(signingString string, sig []byte, key any) error { + var rsaKey *rsa.PublicKey + switch k := key.(type) { + case *rsa.PublicKey: + rsaKey = k + default: + return newError("RSA-PSS verify expects *rsa.PublicKey", ErrInvalidKeyType) + } + + // Create hasher + if !m.Hash.Available() { + return ErrHashUnavailable + } + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + opts := m.Options + if m.VerifyOptions != nil { + opts = m.VerifyOptions + } + + return rsa.VerifyPSS(rsaKey, m.Hash, hasher.Sum(nil), sig, opts) +} + +// Sign implements token signing for the SigningMethod. +// For this signing method, key must be an rsa.PrivateKey struct +func (m *SigningMethodRSAPSS) Sign(signingString string, key any) ([]byte, error) { + var rsaKey *rsa.PrivateKey + + switch k := key.(type) { + case *rsa.PrivateKey: + rsaKey = k + default: + return nil, newError("RSA-PSS sign expects *rsa.PrivateKey", ErrInvalidKeyType) + } + + // Create the hasher + if !m.Hash.Available() { + return nil, ErrHashUnavailable + } + + hasher := m.Hash.New() + hasher.Write([]byte(signingString)) + + // Sign the string and return the encoded bytes + if sigBytes, err := rsa.SignPSS(rand.Reader, rsaKey, m.Hash, hasher.Sum(nil), m.Options); err == nil { + return sigBytes, nil + } else { + return nil, err + } +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go new file mode 100644 index 00000000..f22c3d06 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/rsa_utils.go @@ -0,0 +1,107 @@ +package jwt + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") + ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") + ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") +) + +// ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key +func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey any + if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// ParseRSAPrivateKeyFromPEMWithPassword parses a PEM encoded PKCS1 or PKCS8 private key protected with password +// +// Deprecated: This function is deprecated and should not be used anymore. It uses the deprecated x509.DecryptPEMBlock +// function, which was deprecated since RFC 1423 is regarded insecure by design. Unfortunately, there is no alternative +// in the Go standard library for now. See https://github.com/golang/go/issues/8860. +func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey any + + var blockDecrypted []byte + if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil { + return nil, err + } + + if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// ParseRSAPublicKeyFromPEM parses a certificate or a PEM encoded PKCS1 or PKIX public key +func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey any + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + if parsedKey, err = x509.ParsePKCS1PublicKey(block.Bytes); err != nil { + return nil, err + } + } + } + + var pkey *rsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { + return nil, ErrNotRSAPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/signing_method.go b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go new file mode 100644 index 00000000..096d0ed4 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/signing_method.go @@ -0,0 +1,49 @@ +package jwt + +import ( + "sync" +) + +var signingMethods = map[string]func() SigningMethod{} +var signingMethodLock = new(sync.RWMutex) + +// SigningMethod can be used add new methods for signing or verifying tokens. It +// takes a decoded signature as an input in the Verify function and produces a +// signature in Sign. The signature is then usually base64 encoded as part of a +// JWT. +type SigningMethod interface { + Verify(signingString string, sig []byte, key any) error // Returns nil if signature is valid + Sign(signingString string, key any) ([]byte, error) // Returns signature or error + Alg() string // returns the alg identifier for this method (example: 'HS256') +} + +// RegisterSigningMethod registers the "alg" name and a factory function for signing method. +// This is typically done during init() in the method's implementation +func RegisterSigningMethod(alg string, f func() SigningMethod) { + signingMethodLock.Lock() + defer signingMethodLock.Unlock() + + signingMethods[alg] = f +} + +// GetSigningMethod retrieves a signing method from an "alg" string +func GetSigningMethod(alg string) (method SigningMethod) { + signingMethodLock.RLock() + defer signingMethodLock.RUnlock() + + if methodF, ok := signingMethods[alg]; ok { + method = methodF() + } + return +} + +// GetAlgorithms returns a list of registered "alg" names +func GetAlgorithms() (algs []string) { + signingMethodLock.RLock() + defer signingMethodLock.RUnlock() + + for alg := range signingMethods { + algs = append(algs, alg) + } + return +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf new file mode 100644 index 00000000..53745d51 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/staticcheck.conf @@ -0,0 +1 @@ +checks = ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1023"] diff --git a/vendor/github.com/golang-jwt/jwt/v5/token.go b/vendor/github.com/golang-jwt/jwt/v5/token.go new file mode 100644 index 00000000..3f715588 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/token.go @@ -0,0 +1,100 @@ +package jwt + +import ( + "crypto" + "encoding/base64" + "encoding/json" +) + +// Keyfunc will be used by the Parse methods as a callback function to supply +// the key for verification. The function receives the parsed, but unverified +// Token. This allows you to use properties in the Header of the token (such as +// `kid`) to identify which key to use. +// +// The returned any may be a single key or a VerificationKeySet containing +// multiple keys. +type Keyfunc func(*Token) (any, error) + +// VerificationKey represents a public or secret key for verifying a token's signature. +type VerificationKey interface { + crypto.PublicKey | []uint8 +} + +// VerificationKeySet is a set of public or secret keys. It is used by the parser to verify a token. +type VerificationKeySet struct { + Keys []VerificationKey +} + +// Token represents a JWT Token. Different fields will be used depending on +// whether you're creating or parsing/verifying a token. +type Token struct { + Raw string // Raw contains the raw token. Populated when you [Parse] a token + Method SigningMethod // Method is the signing method used or to be used + Header map[string]any // Header is the first segment of the token in decoded form + Claims Claims // Claims is the second segment of the token in decoded form + Signature []byte // Signature is the third segment of the token in decoded form. Populated when you Parse a token + Valid bool // Valid specifies if the token is valid. Populated when you Parse/Verify a token +} + +// New creates a new [Token] with the specified signing method and an empty map +// of claims. Additional options can be specified, but are currently unused. +func New(method SigningMethod, opts ...TokenOption) *Token { + return NewWithClaims(method, MapClaims{}, opts...) +} + +// NewWithClaims creates a new [Token] with the specified signing method and +// claims. Additional options can be specified, but are currently unused. +func NewWithClaims(method SigningMethod, claims Claims, opts ...TokenOption) *Token { + return &Token{ + Header: map[string]any{ + "typ": "JWT", + "alg": method.Alg(), + }, + Claims: claims, + Method: method, + } +} + +// SignedString creates and returns a complete, signed JWT. The token is signed +// using the SigningMethod specified in the token. Please refer to +// https://golang-jwt.github.io/jwt/usage/signing_methods/#signing-methods-and-key-types +// for an overview of the different signing methods and their respective key +// types. +func (t *Token) SignedString(key any) (string, error) { + sstr, err := t.SigningString() + if err != nil { + return "", err + } + + sig, err := t.Method.Sign(sstr, key) + if err != nil { + return "", err + } + + return sstr + "." + t.EncodeSegment(sig), nil +} + +// SigningString generates the signing string. This is the most expensive part +// of the whole deal. Unless you need this for something special, just go +// straight for the SignedString. +func (t *Token) SigningString() (string, error) { + h, err := json.Marshal(t.Header) + if err != nil { + return "", err + } + + c, err := json.Marshal(t.Claims) + if err != nil { + return "", err + } + + return t.EncodeSegment(h) + "." + t.EncodeSegment(c), nil +} + +// EncodeSegment encodes a JWT specific base64url encoding with padding +// stripped. In the future, this function might take into account a +// [TokenOption]. Therefore, this function exists as a method of [Token], rather +// than a global function. +func (*Token) EncodeSegment(seg []byte) string { + return base64.RawURLEncoding.EncodeToString(seg) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/token_option.go b/vendor/github.com/golang-jwt/jwt/v5/token_option.go new file mode 100644 index 00000000..b4ae3bad --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/token_option.go @@ -0,0 +1,5 @@ +package jwt + +// TokenOption is a reserved type, which provides some forward compatibility, +// if we ever want to introduce token creation-related options. +type TokenOption func(*Token) diff --git a/vendor/github.com/golang-jwt/jwt/v5/types.go b/vendor/github.com/golang-jwt/jwt/v5/types.go new file mode 100644 index 00000000..a3e0ef12 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/types.go @@ -0,0 +1,149 @@ +package jwt + +import ( + "encoding/json" + "fmt" + "math" + "strconv" + "time" +) + +// TimePrecision sets the precision of times and dates within this library. This +// has an influence on the precision of times when comparing expiry or other +// related time fields. Furthermore, it is also the precision of times when +// serializing. +// +// For backwards compatibility the default precision is set to seconds, so that +// no fractional timestamps are generated. +var TimePrecision = time.Second + +// MarshalSingleStringAsArray modifies the behavior of the ClaimStrings type, +// especially its MarshalJSON function. +// +// If it is set to true (the default), it will always serialize the type as an +// array of strings, even if it just contains one element, defaulting to the +// behavior of the underlying []string. If it is set to false, it will serialize +// to a single string, if it contains one element. Otherwise, it will serialize +// to an array of strings. +var MarshalSingleStringAsArray = true + +// NumericDate represents a JSON numeric date value, as referenced at +// https://datatracker.ietf.org/doc/html/rfc7519#section-2. +type NumericDate struct { + time.Time +} + +// NewNumericDate constructs a new *NumericDate from a standard library time.Time struct. +// It will truncate the timestamp according to the precision specified in TimePrecision. +func NewNumericDate(t time.Time) *NumericDate { + return &NumericDate{t.Truncate(TimePrecision)} +} + +// newNumericDateFromSeconds creates a new *NumericDate out of a float64 representing a +// UNIX epoch with the float fraction representing non-integer seconds. +func newNumericDateFromSeconds(f float64) *NumericDate { + round, frac := math.Modf(f) + return NewNumericDate(time.Unix(int64(round), int64(frac*1e9))) +} + +// MarshalJSON is an implementation of the json.RawMessage interface and serializes the UNIX epoch +// represented in NumericDate to a byte array, using the precision specified in TimePrecision. +func (date NumericDate) MarshalJSON() (b []byte, err error) { + var prec int + if TimePrecision < time.Second { + prec = int(math.Log10(float64(time.Second) / float64(TimePrecision))) + } + truncatedDate := date.Truncate(TimePrecision) + + // For very large timestamps, UnixNano would overflow an int64, but this + // function requires nanosecond level precision, so we have to use the + // following technique to get round the issue: + // + // 1. Take the normal unix timestamp to form the whole number part of the + // output, + // 2. Take the result of the Nanosecond function, which returns the offset + // within the second of the particular unix time instance, to form the + // decimal part of the output + // 3. Concatenate them to produce the final result + seconds := strconv.FormatInt(truncatedDate.Unix(), 10) + nanosecondsOffset := strconv.FormatFloat(float64(truncatedDate.Nanosecond())/float64(time.Second), 'f', prec, 64) + + output := append([]byte(seconds), []byte(nanosecondsOffset)[1:]...) + + return output, nil +} + +// UnmarshalJSON is an implementation of the json.RawMessage interface and +// deserializes a [NumericDate] from a JSON representation, i.e. a +// [json.Number]. This number represents an UNIX epoch with either integer or +// non-integer seconds. +func (date *NumericDate) UnmarshalJSON(b []byte) (err error) { + var ( + number json.Number + f float64 + ) + + if err = json.Unmarshal(b, &number); err != nil { + return fmt.Errorf("could not parse NumericData: %w", err) + } + + if f, err = number.Float64(); err != nil { + return fmt.Errorf("could not convert json number value to float: %w", err) + } + + n := newNumericDateFromSeconds(f) + *date = *n + + return nil +} + +// ClaimStrings is basically just a slice of strings, but it can be either +// serialized from a string array or just a string. This type is necessary, +// since the "aud" claim can either be a single string or an array. +type ClaimStrings []string + +func (s *ClaimStrings) UnmarshalJSON(data []byte) (err error) { + var value any + + if err = json.Unmarshal(data, &value); err != nil { + return err + } + + var aud []string + + switch v := value.(type) { + case string: + aud = append(aud, v) + case []string: + aud = ClaimStrings(v) + case []any: + for _, vv := range v { + vs, ok := vv.(string) + if !ok { + return ErrInvalidType + } + aud = append(aud, vs) + } + case nil: + return nil + default: + return ErrInvalidType + } + + *s = aud + + return +} + +func (s ClaimStrings) MarshalJSON() (b []byte, err error) { + // This handles a special case in the JWT RFC. If the string array, e.g. + // used by the "aud" field, only contains one element, it MAY be serialized + // as a single string. This may or may not be desired based on the ecosystem + // of other JWT library used, so we make it configurable by the variable + // MarshalSingleStringAsArray. + if len(s) == 1 && !MarshalSingleStringAsArray { + return json.Marshal(s[0]) + } + + return json.Marshal([]string(s)) +} diff --git a/vendor/github.com/golang-jwt/jwt/v5/validator.go b/vendor/github.com/golang-jwt/jwt/v5/validator.go new file mode 100644 index 00000000..92b5c057 --- /dev/null +++ b/vendor/github.com/golang-jwt/jwt/v5/validator.go @@ -0,0 +1,326 @@ +package jwt + +import ( + "fmt" + "slices" + "time" +) + +// ClaimsValidator is an interface that can be implemented by custom claims who +// wish to execute any additional claims validation based on +// application-specific logic. The Validate function is then executed in +// addition to the regular claims validation and any error returned is appended +// to the final validation result. +// +// type MyCustomClaims struct { +// Foo string `json:"foo"` +// jwt.RegisteredClaims +// } +// +// func (m MyCustomClaims) Validate() error { +// if m.Foo != "bar" { +// return errors.New("must be foobar") +// } +// return nil +// } +type ClaimsValidator interface { + Claims + Validate() error +} + +// Validator is the core of the new Validation API. It is automatically used by +// a [Parser] during parsing and can be modified with various parser options. +// +// The [NewValidator] function should be used to create an instance of this +// struct. +type Validator struct { + // leeway is an optional leeway that can be provided to account for clock skew. + leeway time.Duration + + // timeFunc is used to supply the current time that is needed for + // validation. If unspecified, this defaults to time.Now. + timeFunc func() time.Time + + // requireExp specifies whether the exp claim is required + requireExp bool + + // verifyIat specifies whether the iat (Issued At) claim will be verified. + // According to https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 this + // only specifies the age of the token, but no validation check is + // necessary. However, if wanted, it can be checked if the iat is + // unrealistic, i.e., in the future. + verifyIat bool + + // expectedAud contains the audience this token expects. Supplying an empty + // slice will disable aud checking. + expectedAud []string + + // expectAllAud specifies whether all expected audiences must be present in + // the token. If false, only one of the expected audiences must be present. + expectAllAud bool + + // expectedIss contains the issuer this token expects. Supplying an empty + // string will disable iss checking. + expectedIss string + + // expectedSub contains the subject this token expects. Supplying an empty + // string will disable sub checking. + expectedSub string +} + +// NewValidator can be used to create a stand-alone validator with the supplied +// options. This validator can then be used to validate already parsed claims. +// +// Note: Under normal circumstances, explicitly creating a validator is not +// needed and can potentially be dangerous; instead functions of the [Parser] +// class should be used. +// +// The [Validator] is only checking the *validity* of the claims, such as its +// expiration time, but it does NOT perform *signature verification* of the +// token. +func NewValidator(opts ...ParserOption) *Validator { + p := NewParser(opts...) + return p.validator +} + +// Validate validates the given claims. It will also perform any custom +// validation if claims implements the [ClaimsValidator] interface. +// +// Note: It will NOT perform any *signature verification* on the token that +// contains the claims and expects that the [Claim] was already successfully +// verified. +func (v *Validator) Validate(claims Claims) error { + var ( + now time.Time + errs = make([]error, 0, 6) + err error + ) + + // Check, if we have a time func + if v.timeFunc != nil { + now = v.timeFunc() + } else { + now = time.Now() + } + + // We always need to check the expiration time, but usage of the claim + // itself is OPTIONAL by default. requireExp overrides this behavior + // and makes the exp claim mandatory. + if err = v.verifyExpiresAt(claims, now, v.requireExp); err != nil { + errs = append(errs, err) + } + + // We always need to check not-before, but usage of the claim itself is + // OPTIONAL. + if err = v.verifyNotBefore(claims, now, false); err != nil { + errs = append(errs, err) + } + + // Check issued-at if the option is enabled + if v.verifyIat { + if err = v.verifyIssuedAt(claims, now, false); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected audience, we also require the audience claim + if len(v.expectedAud) > 0 { + if err = v.verifyAudience(claims, v.expectedAud, v.expectAllAud); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected issuer, we also require the issuer claim + if v.expectedIss != "" { + if err = v.verifyIssuer(claims, v.expectedIss, true); err != nil { + errs = append(errs, err) + } + } + + // If we have an expected subject, we also require the subject claim + if v.expectedSub != "" { + if err = v.verifySubject(claims, v.expectedSub, true); err != nil { + errs = append(errs, err) + } + } + + // Finally, we want to give the claim itself some possibility to do some + // additional custom validation based on a custom Validate function. + cvt, ok := claims.(ClaimsValidator) + if ok { + if err := cvt.Validate(); err != nil { + errs = append(errs, err) + } + } + + if len(errs) == 0 { + return nil + } + + return joinErrors(errs...) +} + +// verifyExpiresAt compares the exp claim in claims against cmp. This function +// will succeed if cmp < exp. Additional leeway is taken into account. +// +// If exp is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyExpiresAt(claims Claims, cmp time.Time, required bool) error { + exp, err := claims.GetExpirationTime() + if err != nil { + return err + } + + if exp == nil { + return errorIfRequired(required, "exp") + } + + return errorIfFalse(cmp.Before((exp.Time).Add(+v.leeway)), ErrTokenExpired) +} + +// verifyIssuedAt compares the iat claim in claims against cmp. This function +// will succeed if cmp >= iat. Additional leeway is taken into account. +// +// If iat is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyIssuedAt(claims Claims, cmp time.Time, required bool) error { + iat, err := claims.GetIssuedAt() + if err != nil { + return err + } + + if iat == nil { + return errorIfRequired(required, "iat") + } + + return errorIfFalse(!cmp.Before(iat.Add(-v.leeway)), ErrTokenUsedBeforeIssued) +} + +// verifyNotBefore compares the nbf claim in claims against cmp. This function +// will return true if cmp >= nbf. Additional leeway is taken into account. +// +// If nbf is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyNotBefore(claims Claims, cmp time.Time, required bool) error { + nbf, err := claims.GetNotBefore() + if err != nil { + return err + } + + if nbf == nil { + return errorIfRequired(required, "nbf") + } + + return errorIfFalse(!cmp.Before(nbf.Add(-v.leeway)), ErrTokenNotValidYet) +} + +// verifyAudience compares the aud claim against cmp. +// +// If aud is not set or an empty list, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyAudience(claims Claims, cmp []string, expectAllAud bool) error { + aud, err := claims.GetAudience() + if err != nil { + return err + } + + // Check that aud exists and is not empty. We only require the aud claim + // if we expect at least one audience to be present. + if len(aud) == 0 || len(aud) == 1 && aud[0] == "" { + required := len(v.expectedAud) > 0 + return errorIfRequired(required, "aud") + } + + if !expectAllAud { + for _, a := range aud { + // If we only expect one match, we can stop early if we find a match + if slices.Contains(cmp, a) { + return nil + } + } + + return ErrTokenInvalidAudience + } + + // Note that we are looping cmp here to ensure that all expected audiences + // are present in the aud claim. + for _, a := range cmp { + if !slices.Contains(aud, a) { + return ErrTokenInvalidAudience + } + } + + return nil +} + +// verifyIssuer compares the iss claim in claims against cmp. +// +// If iss is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifyIssuer(claims Claims, cmp string, required bool) error { + iss, err := claims.GetIssuer() + if err != nil { + return err + } + + if iss == "" { + return errorIfRequired(required, "iss") + } + + return errorIfFalse(iss == cmp, ErrTokenInvalidIssuer) +} + +// verifySubject compares the sub claim against cmp. +// +// If sub is not set, it will succeed if the claim is not required, +// otherwise ErrTokenRequiredClaimMissing will be returned. +// +// Additionally, if any error occurs while retrieving the claim, e.g., when its +// the wrong type, an ErrTokenUnverifiable error will be returned. +func (v *Validator) verifySubject(claims Claims, cmp string, required bool) error { + sub, err := claims.GetSubject() + if err != nil { + return err + } + + if sub == "" { + return errorIfRequired(required, "sub") + } + + return errorIfFalse(sub == cmp, ErrTokenInvalidSubject) +} + +// errorIfFalse returns the error specified in err, if the value is true. +// Otherwise, nil is returned. +func errorIfFalse(value bool, err error) error { + if value { + return nil + } else { + return err + } +} + +// errorIfRequired returns an ErrTokenRequiredClaimMissing error if required is +// true. Otherwise, nil is returned. +func errorIfRequired(required bool, claim string) error { + if required { + return newError(fmt.Sprintf("%s claim is required", claim), ErrTokenRequiredClaimMissing) + } else { + return nil + } +} diff --git a/vendor/github.com/google/uuid/CHANGELOG.md b/vendor/github.com/google/uuid/CHANGELOG.md new file mode 100644 index 00000000..7ec5ac7e --- /dev/null +++ b/vendor/github.com/google/uuid/CHANGELOG.md @@ -0,0 +1,41 @@ +# Changelog + +## [1.6.0](https://github.com/google/uuid/compare/v1.5.0...v1.6.0) (2024-01-16) + + +### Features + +* add Max UUID constant ([#149](https://github.com/google/uuid/issues/149)) ([c58770e](https://github.com/google/uuid/commit/c58770eb495f55fe2ced6284f93c5158a62e53e3)) + + +### Bug Fixes + +* fix typo in version 7 uuid documentation ([#153](https://github.com/google/uuid/issues/153)) ([016b199](https://github.com/google/uuid/commit/016b199544692f745ffc8867b914129ecb47ef06)) +* Monotonicity in UUIDv7 ([#150](https://github.com/google/uuid/issues/150)) ([a2b2b32](https://github.com/google/uuid/commit/a2b2b32373ff0b1a312b7fdf6d38a977099698a6)) + +## [1.5.0](https://github.com/google/uuid/compare/v1.4.0...v1.5.0) (2023-12-12) + + +### Features + +* Validate UUID without creating new UUID ([#141](https://github.com/google/uuid/issues/141)) ([9ee7366](https://github.com/google/uuid/commit/9ee7366e66c9ad96bab89139418a713dc584ae29)) + +## [1.4.0](https://github.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26) + + +### Features + +* UUIDs slice type with Strings() convenience method ([#133](https://github.com/google/uuid/issues/133)) ([cd5fbbd](https://github.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4)) + +### Fixes + +* Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior) + +## [1.3.1](https://github.com/google/uuid/compare/v1.3.0...v1.3.1) (2023-08-18) + + +### Bug Fixes + +* Use .EqualFold() to parse urn prefixed UUIDs ([#118](https://github.com/google/uuid/issues/118)) ([574e687](https://github.com/google/uuid/commit/574e6874943741fb99d41764c705173ada5293f0)) + +## Changelog diff --git a/vendor/github.com/google/uuid/CONTRIBUTING.md b/vendor/github.com/google/uuid/CONTRIBUTING.md new file mode 100644 index 00000000..a502fdc5 --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# How to contribute + +We definitely welcome patches and contribution to this project! + +### Tips + +Commits must be formatted according to the [Conventional Commits Specification](https://www.conventionalcommits.org). + +Always try to include a test case! If it is not possible or not necessary, +please explain why in the pull request description. + +### Releasing + +Commits that would precipitate a SemVer change, as described in the Conventional +Commits Specification, will trigger [`release-please`](https://github.com/google-github-actions/release-please-action) +to create a release candidate pull request. Once submitted, `release-please` +will create a release. + +For tips on how to work with `release-please`, see its documentation. + +### Legal requirements + +In order to protect both you and ourselves, you will need to sign the +[Contributor License Agreement](https://cla.developers.google.com/clas). + +You may have already signed it for other Google projects. diff --git a/vendor/github.com/google/uuid/CONTRIBUTORS b/vendor/github.com/google/uuid/CONTRIBUTORS new file mode 100644 index 00000000..b4bb97f6 --- /dev/null +++ b/vendor/github.com/google/uuid/CONTRIBUTORS @@ -0,0 +1,9 @@ +Paul Borman +bmatsuo +shawnps +theory +jboverfelt +dsymonds +cd1 +wallclockbuilder +dansouza diff --git a/vendor/github.com/google/uuid/LICENSE b/vendor/github.com/google/uuid/LICENSE new file mode 100644 index 00000000..5dc68268 --- /dev/null +++ b/vendor/github.com/google/uuid/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009,2014 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/google/uuid/README.md b/vendor/github.com/google/uuid/README.md new file mode 100644 index 00000000..3e9a6188 --- /dev/null +++ b/vendor/github.com/google/uuid/README.md @@ -0,0 +1,21 @@ +# uuid +The uuid package generates and inspects UUIDs based on +[RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) +and DCE 1.1: Authentication and Security Services. + +This package is based on the github.com/pborman/uuid package (previously named +code.google.com/p/go-uuid). It differs from these earlier packages in that +a UUID is a 16 byte array rather than a byte slice. One loss due to this +change is the ability to represent an invalid UUID (vs a NIL UUID). + +###### Install +```sh +go get github.com/google/uuid +``` + +###### Documentation +[![Go Reference](https://pkg.go.dev/badge/github.com/google/uuid.svg)](https://pkg.go.dev/github.com/google/uuid) + +Full `go doc` style documentation for the package can be viewed online without +installing this package by using the GoDoc site here: +http://pkg.go.dev/github.com/google/uuid diff --git a/vendor/github.com/google/uuid/dce.go b/vendor/github.com/google/uuid/dce.go new file mode 100644 index 00000000..fa820b9d --- /dev/null +++ b/vendor/github.com/google/uuid/dce.go @@ -0,0 +1,80 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "fmt" + "os" +) + +// A Domain represents a Version 2 domain +type Domain byte + +// Domain constants for DCE Security (Version 2) UUIDs. +const ( + Person = Domain(0) + Group = Domain(1) + Org = Domain(2) +) + +// NewDCESecurity returns a DCE Security (Version 2) UUID. +// +// The domain should be one of Person, Group or Org. +// On a POSIX system the id should be the users UID for the Person +// domain and the users GID for the Group. The meaning of id for +// the domain Org or on non-POSIX systems is site defined. +// +// For a given domain/id pair the same token may be returned for up to +// 7 minutes and 10 seconds. +func NewDCESecurity(domain Domain, id uint32) (UUID, error) { + uuid, err := NewUUID() + if err == nil { + uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2 + uuid[9] = byte(domain) + binary.BigEndian.PutUint32(uuid[0:], id) + } + return uuid, err +} + +// NewDCEPerson returns a DCE Security (Version 2) UUID in the person +// domain with the id returned by os.Getuid. +// +// NewDCESecurity(Person, uint32(os.Getuid())) +func NewDCEPerson() (UUID, error) { + return NewDCESecurity(Person, uint32(os.Getuid())) +} + +// NewDCEGroup returns a DCE Security (Version 2) UUID in the group +// domain with the id returned by os.Getgid. +// +// NewDCESecurity(Group, uint32(os.Getgid())) +func NewDCEGroup() (UUID, error) { + return NewDCESecurity(Group, uint32(os.Getgid())) +} + +// Domain returns the domain for a Version 2 UUID. Domains are only defined +// for Version 2 UUIDs. +func (uuid UUID) Domain() Domain { + return Domain(uuid[9]) +} + +// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2 +// UUIDs. +func (uuid UUID) ID() uint32 { + return binary.BigEndian.Uint32(uuid[0:4]) +} + +func (d Domain) String() string { + switch d { + case Person: + return "Person" + case Group: + return "Group" + case Org: + return "Org" + } + return fmt.Sprintf("Domain%d", int(d)) +} diff --git a/vendor/github.com/google/uuid/doc.go b/vendor/github.com/google/uuid/doc.go new file mode 100644 index 00000000..5b8a4b9a --- /dev/null +++ b/vendor/github.com/google/uuid/doc.go @@ -0,0 +1,12 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package uuid generates and inspects UUIDs. +// +// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security +// Services. +// +// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to +// maps or compared directly. +package uuid diff --git a/vendor/github.com/google/uuid/hash.go b/vendor/github.com/google/uuid/hash.go new file mode 100644 index 00000000..dc60082d --- /dev/null +++ b/vendor/github.com/google/uuid/hash.go @@ -0,0 +1,59 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "crypto/md5" + "crypto/sha1" + "hash" +) + +// Well known namespace IDs and UUIDs +var ( + NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) + NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) + Nil UUID // empty UUID, all zeros + + // The Max UUID is special form of UUID that is specified to have all 128 bits set to 1. + Max = UUID{ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + } +) + +// NewHash returns a new UUID derived from the hash of space concatenated with +// data generated by h. The hash should be at least 16 byte in length. The +// first 16 bytes of the hash are used to form the UUID. The version of the +// UUID will be the lower 4 bits of version. NewHash is used to implement +// NewMD5 and NewSHA1. +func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID { + h.Reset() + h.Write(space[:]) //nolint:errcheck + h.Write(data) //nolint:errcheck + s := h.Sum(nil) + var uuid UUID + copy(uuid[:], s) + uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4) + uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant + return uuid +} + +// NewMD5 returns a new MD5 (Version 3) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(md5.New(), space, data, 3) +func NewMD5(space UUID, data []byte) UUID { + return NewHash(md5.New(), space, data, 3) +} + +// NewSHA1 returns a new SHA1 (Version 5) UUID based on the +// supplied name space and data. It is the same as calling: +// +// NewHash(sha1.New(), space, data, 5) +func NewSHA1(space UUID, data []byte) UUID { + return NewHash(sha1.New(), space, data, 5) +} diff --git a/vendor/github.com/google/uuid/marshal.go b/vendor/github.com/google/uuid/marshal.go new file mode 100644 index 00000000..14bd3407 --- /dev/null +++ b/vendor/github.com/google/uuid/marshal.go @@ -0,0 +1,38 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "fmt" + +// MarshalText implements encoding.TextMarshaler. +func (uuid UUID) MarshalText() ([]byte, error) { + var js [36]byte + encodeHex(js[:], uuid) + return js[:], nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (uuid *UUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err != nil { + return err + } + *uuid = id + return nil +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (uuid UUID) MarshalBinary() ([]byte, error) { + return uuid[:], nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (uuid *UUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(uuid[:], data) + return nil +} diff --git a/vendor/github.com/google/uuid/node.go b/vendor/github.com/google/uuid/node.go new file mode 100644 index 00000000..d651a2b0 --- /dev/null +++ b/vendor/github.com/google/uuid/node.go @@ -0,0 +1,90 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "sync" +) + +var ( + nodeMu sync.Mutex + ifname string // name of interface being used + nodeID [6]byte // hardware for version 1 UUIDs + zeroID [6]byte // nodeID with only 0's +) + +// NodeInterface returns the name of the interface from which the NodeID was +// derived. The interface "user" is returned if the NodeID was set by +// SetNodeID. +func NodeInterface() string { + defer nodeMu.Unlock() + nodeMu.Lock() + return ifname +} + +// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs. +// If name is "" then the first usable interface found will be used or a random +// Node ID will be generated. If a named interface cannot be found then false +// is returned. +// +// SetNodeInterface never fails when name is "". +func SetNodeInterface(name string) bool { + defer nodeMu.Unlock() + nodeMu.Lock() + return setNodeInterface(name) +} + +func setNodeInterface(name string) bool { + iname, addr := getHardwareInterface(name) // null implementation for js + if iname != "" && addr != nil { + ifname = iname + copy(nodeID[:], addr) + return true + } + + // We found no interfaces with a valid hardware address. If name + // does not specify a specific interface generate a random Node ID + // (section 4.1.6) + if name == "" { + ifname = "random" + randomBits(nodeID[:]) + return true + } + return false +} + +// NodeID returns a slice of a copy of the current Node ID, setting the Node ID +// if not already set. +func NodeID() []byte { + defer nodeMu.Unlock() + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + nid := nodeID + return nid[:] +} + +// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes +// of id are used. If id is less than 6 bytes then false is returned and the +// Node ID is not set. +func SetNodeID(id []byte) bool { + if len(id) < 6 { + return false + } + defer nodeMu.Unlock() + nodeMu.Lock() + copy(nodeID[:], id) + ifname = "user" + return true +} + +// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is +// not valid. The NodeID is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) NodeID() []byte { + var node [6]byte + copy(node[:], uuid[10:]) + return node[:] +} diff --git a/vendor/github.com/google/uuid/node_js.go b/vendor/github.com/google/uuid/node_js.go new file mode 100644 index 00000000..b2a0bc87 --- /dev/null +++ b/vendor/github.com/google/uuid/node_js.go @@ -0,0 +1,12 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build js + +package uuid + +// getHardwareInterface returns nil values for the JS version of the code. +// This removes the "net" dependency, because it is not used in the browser. +// Using the "net" library inflates the size of the transpiled JS code by 673k bytes. +func getHardwareInterface(name string) (string, []byte) { return "", nil } diff --git a/vendor/github.com/google/uuid/node_net.go b/vendor/github.com/google/uuid/node_net.go new file mode 100644 index 00000000..0cbbcddb --- /dev/null +++ b/vendor/github.com/google/uuid/node_net.go @@ -0,0 +1,33 @@ +// Copyright 2017 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !js + +package uuid + +import "net" + +var interfaces []net.Interface // cached list of interfaces + +// getHardwareInterface returns the name and hardware address of interface name. +// If name is "" then the name and hardware address of one of the system's +// interfaces is returned. If no interfaces are found (name does not exist or +// there are no interfaces) then "", nil is returned. +// +// Only addresses of at least 6 bytes are returned. +func getHardwareInterface(name string) (string, []byte) { + if interfaces == nil { + var err error + interfaces, err = net.Interfaces() + if err != nil { + return "", nil + } + } + for _, ifs := range interfaces { + if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) { + return ifs.Name, ifs.HardwareAddr + } + } + return "", nil +} diff --git a/vendor/github.com/google/uuid/null.go b/vendor/github.com/google/uuid/null.go new file mode 100644 index 00000000..d7fcbf28 --- /dev/null +++ b/vendor/github.com/google/uuid/null.go @@ -0,0 +1,118 @@ +// Copyright 2021 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "database/sql/driver" + "encoding/json" + "fmt" +) + +var jsonNull = []byte("null") + +// NullUUID represents a UUID that may be null. +// NullUUID implements the SQL driver.Scanner interface so +// it can be used as a scan destination: +// +// var u uuid.NullUUID +// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&u) +// ... +// if u.Valid { +// // use u.UUID +// } else { +// // NULL value +// } +// +type NullUUID struct { + UUID UUID + Valid bool // Valid is true if UUID is not NULL +} + +// Scan implements the SQL driver.Scanner interface. +func (nu *NullUUID) Scan(value interface{}) error { + if value == nil { + nu.UUID, nu.Valid = Nil, false + return nil + } + + err := nu.UUID.Scan(value) + if err != nil { + nu.Valid = false + return err + } + + nu.Valid = true + return nil +} + +// Value implements the driver Valuer interface. +func (nu NullUUID) Value() (driver.Value, error) { + if !nu.Valid { + return nil, nil + } + // Delegate to UUID Value function + return nu.UUID.Value() +} + +// MarshalBinary implements encoding.BinaryMarshaler. +func (nu NullUUID) MarshalBinary() ([]byte, error) { + if nu.Valid { + return nu.UUID[:], nil + } + + return []byte(nil), nil +} + +// UnmarshalBinary implements encoding.BinaryUnmarshaler. +func (nu *NullUUID) UnmarshalBinary(data []byte) error { + if len(data) != 16 { + return fmt.Errorf("invalid UUID (got %d bytes)", len(data)) + } + copy(nu.UUID[:], data) + nu.Valid = true + return nil +} + +// MarshalText implements encoding.TextMarshaler. +func (nu NullUUID) MarshalText() ([]byte, error) { + if nu.Valid { + return nu.UUID.MarshalText() + } + + return jsonNull, nil +} + +// UnmarshalText implements encoding.TextUnmarshaler. +func (nu *NullUUID) UnmarshalText(data []byte) error { + id, err := ParseBytes(data) + if err != nil { + nu.Valid = false + return err + } + nu.UUID = id + nu.Valid = true + return nil +} + +// MarshalJSON implements json.Marshaler. +func (nu NullUUID) MarshalJSON() ([]byte, error) { + if nu.Valid { + return json.Marshal(nu.UUID) + } + + return jsonNull, nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (nu *NullUUID) UnmarshalJSON(data []byte) error { + if bytes.Equal(data, jsonNull) { + *nu = NullUUID{} + return nil // valid null UUID + } + err := json.Unmarshal(data, &nu.UUID) + nu.Valid = err == nil + return err +} diff --git a/vendor/github.com/google/uuid/sql.go b/vendor/github.com/google/uuid/sql.go new file mode 100644 index 00000000..2e02ec06 --- /dev/null +++ b/vendor/github.com/google/uuid/sql.go @@ -0,0 +1,59 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "database/sql/driver" + "fmt" +) + +// Scan implements sql.Scanner so UUIDs can be read from databases transparently. +// Currently, database types that map to string and []byte are supported. Please +// consult database-specific driver documentation for matching types. +func (uuid *UUID) Scan(src interface{}) error { + switch src := src.(type) { + case nil: + return nil + + case string: + // if an empty UUID comes from a table, we return a null UUID + if src == "" { + return nil + } + + // see Parse for required string format + u, err := Parse(src) + if err != nil { + return fmt.Errorf("Scan: %v", err) + } + + *uuid = u + + case []byte: + // if an empty UUID comes from a table, we return a null UUID + if len(src) == 0 { + return nil + } + + // assumes a simple slice of bytes if 16 bytes + // otherwise attempts to parse + if len(src) != 16 { + return uuid.Scan(string(src)) + } + copy((*uuid)[:], src) + + default: + return fmt.Errorf("Scan: unable to scan type %T into UUID", src) + } + + return nil +} + +// Value implements sql.Valuer so that UUIDs can be written to databases +// transparently. Currently, UUIDs map to strings. Please consult +// database-specific driver documentation for matching types. +func (uuid UUID) Value() (driver.Value, error) { + return uuid.String(), nil +} diff --git a/vendor/github.com/google/uuid/time.go b/vendor/github.com/google/uuid/time.go new file mode 100644 index 00000000..c3511292 --- /dev/null +++ b/vendor/github.com/google/uuid/time.go @@ -0,0 +1,134 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" + "sync" + "time" +) + +// A Time represents a time as the number of 100's of nanoseconds since 15 Oct +// 1582. +type Time int64 + +const ( + lillian = 2299160 // Julian day of 15 Oct 1582 + unix = 2440587 // Julian day of 1 Jan 1970 + epoch = unix - lillian // Days between epochs + g1582 = epoch * 86400 // seconds between epochs + g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs +) + +var ( + timeMu sync.Mutex + lasttime uint64 // last time we returned + clockSeq uint16 // clock sequence for this run + + timeNow = time.Now // for testing +) + +// UnixTime converts t the number of seconds and nanoseconds using the Unix +// epoch of 1 Jan 1970. +func (t Time) UnixTime() (sec, nsec int64) { + sec = int64(t - g1582ns100) + nsec = (sec % 10000000) * 100 + sec /= 10000000 + return sec, nsec +} + +// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and +// clock sequence as well as adjusting the clock sequence as needed. An error +// is returned if the current time cannot be determined. +func GetTime() (Time, uint16, error) { + defer timeMu.Unlock() + timeMu.Lock() + return getTime() +} + +func getTime() (Time, uint16, error) { + t := timeNow() + + // If we don't have a clock sequence already, set one. + if clockSeq == 0 { + setClockSequence(-1) + } + now := uint64(t.UnixNano()/100) + g1582ns100 + + // If time has gone backwards with this clock sequence then we + // increment the clock sequence + if now <= lasttime { + clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000 + } + lasttime = now + return Time(now), clockSeq, nil +} + +// ClockSequence returns the current clock sequence, generating one if not +// already set. The clock sequence is only used for Version 1 UUIDs. +// +// The uuid package does not use global static storage for the clock sequence or +// the last time a UUID was generated. Unless SetClockSequence is used, a new +// random clock sequence is generated the first time a clock sequence is +// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1) +func ClockSequence() int { + defer timeMu.Unlock() + timeMu.Lock() + return clockSequence() +} + +func clockSequence() int { + if clockSeq == 0 { + setClockSequence(-1) + } + return int(clockSeq & 0x3fff) +} + +// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to +// -1 causes a new sequence to be generated. +func SetClockSequence(seq int) { + defer timeMu.Unlock() + timeMu.Lock() + setClockSequence(seq) +} + +func setClockSequence(seq int) { + if seq == -1 { + var b [2]byte + randomBits(b[:]) // clock sequence + seq = int(b[0])<<8 | int(b[1]) + } + oldSeq := clockSeq + clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant + if oldSeq != clockSeq { + lasttime = 0 + } +} + +// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in +// uuid. The time is only defined for version 1, 2, 6 and 7 UUIDs. +func (uuid UUID) Time() Time { + var t Time + switch uuid.Version() { + case 6: + time := binary.BigEndian.Uint64(uuid[:8]) // Ignore uuid[6] version b0110 + t = Time(time) + case 7: + time := binary.BigEndian.Uint64(uuid[:8]) + t = Time((time>>16)*10000 + g1582ns100) + default: // forward compatible + time := int64(binary.BigEndian.Uint32(uuid[0:4])) + time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32 + time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48 + t = Time(time) + } + return t +} + +// ClockSequence returns the clock sequence encoded in uuid. +// The clock sequence is only well defined for version 1 and 2 UUIDs. +func (uuid UUID) ClockSequence() int { + return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff +} diff --git a/vendor/github.com/google/uuid/util.go b/vendor/github.com/google/uuid/util.go new file mode 100644 index 00000000..5ea6c737 --- /dev/null +++ b/vendor/github.com/google/uuid/util.go @@ -0,0 +1,43 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// randomBits completely fills slice b with random data. +func randomBits(b []byte) { + if _, err := io.ReadFull(rander, b); err != nil { + panic(err.Error()) // rand should never fail + } +} + +// xvalues returns the value of a byte as a hexadecimal digit or 255. +var xvalues = [256]byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, +} + +// xtob converts hex characters x1 and x2 into a byte. +func xtob(x1, x2 byte) (byte, bool) { + b1 := xvalues[x1] + b2 := xvalues[x2] + return (b1 << 4) | b2, b1 != 255 && b2 != 255 +} diff --git a/vendor/github.com/google/uuid/uuid.go b/vendor/github.com/google/uuid/uuid.go new file mode 100644 index 00000000..5232b486 --- /dev/null +++ b/vendor/github.com/google/uuid/uuid.go @@ -0,0 +1,365 @@ +// Copyright 2018 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "bytes" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "io" + "strings" + "sync" +) + +// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC +// 4122. +type UUID [16]byte + +// A Version represents a UUID's version. +type Version byte + +// A Variant represents a UUID's variant. +type Variant byte + +// Constants returned by Variant. +const ( + Invalid = Variant(iota) // Invalid UUID + RFC4122 // The variant specified in RFC4122 + Reserved // Reserved, NCS backward compatibility. + Microsoft // Reserved, Microsoft Corporation backward compatibility. + Future // Reserved for future definition. +) + +const randPoolSize = 16 * 16 + +var ( + rander = rand.Reader // random function + poolEnabled = false + poolMu sync.Mutex + poolPos = randPoolSize // protected with poolMu + pool [randPoolSize]byte // protected with poolMu +) + +type invalidLengthError struct{ len int } + +func (err invalidLengthError) Error() string { + return fmt.Sprintf("invalid UUID length: %d", err.len) +} + +// IsInvalidLengthError is matcher function for custom error invalidLengthError +func IsInvalidLengthError(err error) bool { + _, ok := err.(invalidLengthError) + return ok +} + +// Parse decodes s into a UUID or returns an error if it cannot be parsed. Both +// the standard UUID forms defined in RFC 4122 +// (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) are decoded. In addition, +// Parse accepts non-standard strings such as the raw hex encoding +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx and 38 byte "Microsoft style" encodings, +// e.g. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. Only the middle 36 bytes are +// examined in the latter case. Parse should not be used to validate strings as +// it parses non-standard encodings as indicated above. +func Parse(s string) (UUID, error) { + var uuid UUID + switch len(s) { + // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36: + + // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: + if !strings.EqualFold(s[:9], "urn:uuid:") { + return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + + // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + case 36 + 2: + s = s[1:] + + // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + case 32: + var ok bool + for i := range uuid { + uuid[i], ok = xtob(s[i*2], s[i*2+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, invalidLengthError{len(s)} + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34, + } { + v, ok := xtob(s[x], s[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// ParseBytes is like Parse, except it parses a byte slice instead of a string. +func ParseBytes(b []byte) (UUID, error) { + var uuid UUID + switch len(b) { + case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if !bytes.EqualFold(b[:9], []byte("urn:uuid:")) { + return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9]) + } + b = b[9:] + case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} + b = b[1:] + case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + var ok bool + for i := 0; i < 32; i += 2 { + uuid[i/2], ok = xtob(b[i], b[i+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + } + return uuid, nil + default: + return uuid, invalidLengthError{len(b)} + } + // s is now at least 36 bytes long + // it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx + if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { + return uuid, errors.New("invalid UUID format") + } + for i, x := range [16]int{ + 0, 2, 4, 6, + 9, 11, + 14, 16, + 19, 21, + 24, 26, 28, 30, 32, 34, + } { + v, ok := xtob(b[x], b[x+1]) + if !ok { + return uuid, errors.New("invalid UUID format") + } + uuid[i] = v + } + return uuid, nil +} + +// MustParse is like Parse but panics if the string cannot be parsed. +// It simplifies safe initialization of global variables holding compiled UUIDs. +func MustParse(s string) UUID { + uuid, err := Parse(s) + if err != nil { + panic(`uuid: Parse(` + s + `): ` + err.Error()) + } + return uuid +} + +// FromBytes creates a new UUID from a byte slice. Returns an error if the slice +// does not have a length of 16. The bytes are copied from the slice. +func FromBytes(b []byte) (uuid UUID, err error) { + err = uuid.UnmarshalBinary(b) + return uuid, err +} + +// Must returns uuid if err is nil and panics otherwise. +func Must(uuid UUID, err error) UUID { + if err != nil { + panic(err) + } + return uuid +} + +// Validate returns an error if s is not a properly formatted UUID in one of the following formats: +// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} +// It returns an error if the format is invalid, otherwise nil. +func Validate(s string) error { + switch len(s) { + // Standard UUID format + case 36: + + // UUID with "urn:uuid:" prefix + case 36 + 9: + if !strings.EqualFold(s[:9], "urn:uuid:") { + return fmt.Errorf("invalid urn prefix: %q", s[:9]) + } + s = s[9:] + + // UUID enclosed in braces + case 36 + 2: + if s[0] != '{' || s[len(s)-1] != '}' { + return fmt.Errorf("invalid bracketed UUID format") + } + s = s[1 : len(s)-1] + + // UUID without hyphens + case 32: + for i := 0; i < len(s); i += 2 { + _, ok := xtob(s[i], s[i+1]) + if !ok { + return errors.New("invalid UUID format") + } + } + + default: + return invalidLengthError{len(s)} + } + + // Check for standard UUID format + if len(s) == 36 { + if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { + return errors.New("invalid UUID format") + } + for _, x := range []int{0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34} { + if _, ok := xtob(s[x], s[x+1]); !ok { + return errors.New("invalid UUID format") + } + } + } + + return nil +} + +// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +// , or "" if uuid is invalid. +func (uuid UUID) String() string { + var buf [36]byte + encodeHex(buf[:], uuid) + return string(buf[:]) +} + +// URN returns the RFC 2141 URN form of uuid, +// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. +func (uuid UUID) URN() string { + var buf [36 + 9]byte + copy(buf[:], "urn:uuid:") + encodeHex(buf[9:], uuid) + return string(buf[:]) +} + +func encodeHex(dst []byte, uuid UUID) { + hex.Encode(dst, uuid[:4]) + dst[8] = '-' + hex.Encode(dst[9:13], uuid[4:6]) + dst[13] = '-' + hex.Encode(dst[14:18], uuid[6:8]) + dst[18] = '-' + hex.Encode(dst[19:23], uuid[8:10]) + dst[23] = '-' + hex.Encode(dst[24:], uuid[10:]) +} + +// Variant returns the variant encoded in uuid. +func (uuid UUID) Variant() Variant { + switch { + case (uuid[8] & 0xc0) == 0x80: + return RFC4122 + case (uuid[8] & 0xe0) == 0xc0: + return Microsoft + case (uuid[8] & 0xe0) == 0xe0: + return Future + default: + return Reserved + } +} + +// Version returns the version of uuid. +func (uuid UUID) Version() Version { + return Version(uuid[6] >> 4) +} + +func (v Version) String() string { + if v > 15 { + return fmt.Sprintf("BAD_VERSION_%d", v) + } + return fmt.Sprintf("VERSION_%d", v) +} + +func (v Variant) String() string { + switch v { + case RFC4122: + return "RFC4122" + case Reserved: + return "Reserved" + case Microsoft: + return "Microsoft" + case Future: + return "Future" + case Invalid: + return "Invalid" + } + return fmt.Sprintf("BadVariant%d", int(v)) +} + +// SetRand sets the random number generator to r, which implements io.Reader. +// If r.Read returns an error when the package requests random data then +// a panic will be issued. +// +// Calling SetRand with nil sets the random number generator to the default +// generator. +func SetRand(r io.Reader) { + if r == nil { + rander = rand.Reader + return + } + rander = r +} + +// EnableRandPool enables internal randomness pool used for Random +// (Version 4) UUID generation. The pool contains random bytes read from +// the random number generator on demand in batches. Enabling the pool +// may improve the UUID generation throughput significantly. +// +// Since the pool is stored on the Go heap, this feature may be a bad fit +// for security sensitive applications. +// +// Both EnableRandPool and DisableRandPool are not thread-safe and should +// only be called when there is no possibility that New or any other +// UUID Version 4 generation function will be called concurrently. +func EnableRandPool() { + poolEnabled = true +} + +// DisableRandPool disables the randomness pool if it was previously +// enabled with EnableRandPool. +// +// Both EnableRandPool and DisableRandPool are not thread-safe and should +// only be called when there is no possibility that New or any other +// UUID Version 4 generation function will be called concurrently. +func DisableRandPool() { + poolEnabled = false + defer poolMu.Unlock() + poolMu.Lock() + poolPos = randPoolSize +} + +// UUIDs is a slice of UUID types. +type UUIDs []UUID + +// Strings returns a string slice containing the string form of each UUID in uuids. +func (uuids UUIDs) Strings() []string { + var uuidStrs = make([]string, len(uuids)) + for i, uuid := range uuids { + uuidStrs[i] = uuid.String() + } + return uuidStrs +} diff --git a/vendor/github.com/google/uuid/version1.go b/vendor/github.com/google/uuid/version1.go new file mode 100644 index 00000000..46310962 --- /dev/null +++ b/vendor/github.com/google/uuid/version1.go @@ -0,0 +1,44 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "encoding/binary" +) + +// NewUUID returns a Version 1 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewUUID returns nil. If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewUUID returns nil and an error. +// +// In most cases, New should be used. +func NewUUID() (UUID, error) { + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + timeLow := uint32(now & 0xffffffff) + timeMid := uint16((now >> 32) & 0xffff) + timeHi := uint16((now >> 48) & 0x0fff) + timeHi |= 0x1000 // Version 1 + + binary.BigEndian.PutUint32(uuid[0:], timeLow) + binary.BigEndian.PutUint16(uuid[4:], timeMid) + binary.BigEndian.PutUint16(uuid[6:], timeHi) + binary.BigEndian.PutUint16(uuid[8:], seq) + + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + copy(uuid[10:], nodeID[:]) + nodeMu.Unlock() + + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version4.go b/vendor/github.com/google/uuid/version4.go new file mode 100644 index 00000000..7697802e --- /dev/null +++ b/vendor/github.com/google/uuid/version4.go @@ -0,0 +1,76 @@ +// Copyright 2016 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "io" + +// New creates a new random UUID or panics. New is equivalent to +// the expression +// +// uuid.Must(uuid.NewRandom()) +func New() UUID { + return Must(NewRandom()) +} + +// NewString creates a new random UUID and returns it as a string or panics. +// NewString is equivalent to the expression +// +// uuid.New().String() +func NewString() string { + return Must(NewRandom()).String() +} + +// NewRandom returns a Random (Version 4) UUID. +// +// The strength of the UUIDs is based on the strength of the crypto/rand +// package. +// +// Uses the randomness pool if it was enabled with EnableRandPool. +// +// A note about uniqueness derived from the UUID Wikipedia entry: +// +// Randomly generated UUIDs have 122 random bits. One's annual risk of being +// hit by a meteorite is estimated to be one chance in 17 billion, that +// means the probability is about 0.00000000006 (6 × 10−11), +// equivalent to the odds of creating a few tens of trillions of UUIDs in a +// year and having one duplicate. +func NewRandom() (UUID, error) { + if !poolEnabled { + return NewRandomFromReader(rander) + } + return newRandomFromPool() +} + +// NewRandomFromReader returns a UUID based on bytes read from a given io.Reader. +func NewRandomFromReader(r io.Reader) (UUID, error) { + var uuid UUID + _, err := io.ReadFull(r, uuid[:]) + if err != nil { + return Nil, err + } + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} + +func newRandomFromPool() (UUID, error) { + var uuid UUID + poolMu.Lock() + if poolPos == randPoolSize { + _, err := io.ReadFull(rander, pool[:]) + if err != nil { + poolMu.Unlock() + return Nil, err + } + poolPos = 0 + } + copy(uuid[:], pool[poolPos:(poolPos+16)]) + poolPos += 16 + poolMu.Unlock() + + uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4 + uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10 + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version6.go b/vendor/github.com/google/uuid/version6.go new file mode 100644 index 00000000..339a959a --- /dev/null +++ b/vendor/github.com/google/uuid/version6.go @@ -0,0 +1,56 @@ +// Copyright 2023 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import "encoding/binary" + +// UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality. +// It is expected that UUIDv6 will primarily be used in contexts where there are existing v1 UUIDs. +// Systems that do not involve legacy UUIDv1 SHOULD consider using UUIDv7 instead. +// +// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#uuidv6 +// +// NewV6 returns a Version 6 UUID based on the current NodeID and clock +// sequence, and the current time. If the NodeID has not been set by SetNodeID +// or SetNodeInterface then it will be set automatically. If the NodeID cannot +// be set NewV6 set NodeID is random bits automatically . If clock sequence has not been set by +// SetClockSequence then it will be set automatically. If GetTime fails to +// return the current NewV6 returns Nil and an error. +func NewV6() (UUID, error) { + var uuid UUID + now, seq, err := GetTime() + if err != nil { + return uuid, err + } + + /* + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | time_high | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | time_mid | time_low_and_version | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |clk_seq_hi_res | clk_seq_low | node (0-1) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | node (2-5) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + + binary.BigEndian.PutUint64(uuid[0:], uint64(now)) + binary.BigEndian.PutUint16(uuid[8:], seq) + + uuid[6] = 0x60 | (uuid[6] & 0x0F) + uuid[8] = 0x80 | (uuid[8] & 0x3F) + + nodeMu.Lock() + if nodeID == zeroID { + setNodeInterface("") + } + copy(uuid[10:], nodeID[:]) + nodeMu.Unlock() + + return uuid, nil +} diff --git a/vendor/github.com/google/uuid/version7.go b/vendor/github.com/google/uuid/version7.go new file mode 100644 index 00000000..3167b643 --- /dev/null +++ b/vendor/github.com/google/uuid/version7.go @@ -0,0 +1,104 @@ +// Copyright 2023 Google Inc. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package uuid + +import ( + "io" +) + +// UUID version 7 features a time-ordered value field derived from the widely +// implemented and well known Unix Epoch timestamp source, +// the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded. +// As well as improved entropy characteristics over versions 1 or 6. +// +// see https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03#name-uuid-version-7 +// +// Implementations SHOULD utilize UUID version 7 over UUID version 1 and 6 if possible. +// +// NewV7 returns a Version 7 UUID based on the current time(Unix Epoch). +// Uses the randomness pool if it was enabled with EnableRandPool. +// On error, NewV7 returns Nil and an error +func NewV7() (UUID, error) { + uuid, err := NewRandom() + if err != nil { + return uuid, err + } + makeV7(uuid[:]) + return uuid, nil +} + +// NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch). +// it use NewRandomFromReader fill random bits. +// On error, NewV7FromReader returns Nil and an error. +func NewV7FromReader(r io.Reader) (UUID, error) { + uuid, err := NewRandomFromReader(r) + if err != nil { + return uuid, err + } + + makeV7(uuid[:]) + return uuid, nil +} + +// makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6]) +// uuid[8] already has the right version number (Variant is 10) +// see function NewV7 and NewV7FromReader +func makeV7(uuid []byte) { + /* + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | unix_ts_ms | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | unix_ts_ms | ver | rand_a (12 bit seq) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |var| rand_b | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | rand_b | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ + _ = uuid[15] // bounds check + + t, s := getV7Time() + + uuid[0] = byte(t >> 40) + uuid[1] = byte(t >> 32) + uuid[2] = byte(t >> 24) + uuid[3] = byte(t >> 16) + uuid[4] = byte(t >> 8) + uuid[5] = byte(t) + + uuid[6] = 0x70 | (0x0F & byte(s>>8)) + uuid[7] = byte(s) +} + +// lastV7time is the last time we returned stored as: +// +// 52 bits of time in milliseconds since epoch +// 12 bits of (fractional nanoseconds) >> 8 +var lastV7time int64 + +const nanoPerMilli = 1000000 + +// getV7Time returns the time in milliseconds and nanoseconds / 256. +// The returned (milli << 12 + seq) is guarenteed to be greater than +// (milli << 12 + seq) returned by any previous call to getV7Time. +func getV7Time() (milli, seq int64) { + timeMu.Lock() + defer timeMu.Unlock() + + nano := timeNow().UnixNano() + milli = nano / nanoPerMilli + // Sequence number is between 0 and 3906 (nanoPerMilli>>8) + seq = (nano - milli*nanoPerMilli) >> 8 + now := milli<<12 + seq + if now <= lastV7time { + now = lastV7time + 1 + milli = now >> 12 + seq = now & 0xfff + } + lastV7time = now + return milli, seq +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/LICENSE.md b/vendor/github.com/stackitcloud/stackit-sdk-go/core/LICENSE.md new file mode 100644 index 00000000..7e2f0648 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2025 Schwarz IT KG + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/NOTICE.txt b/vendor/github.com/stackitcloud/stackit-sdk-go/core/NOTICE.txt new file mode 100644 index 00000000..e82d5ec3 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/NOTICE.txt @@ -0,0 +1,2 @@ +STACKIT Core SDK for Go +Copyright 2025 Schwarz IT KG \ No newline at end of file diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/auth/auth.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/auth/auth.go new file mode 100644 index 00000000..7da6c968 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/auth/auth.go @@ -0,0 +1,358 @@ +package auth + +import ( + "encoding/json" + "fmt" + "net/http" + "os" + "path/filepath" + + "github.com/stackitcloud/stackit-sdk-go/core/clients" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +type credentialType string + +type Credentials struct { + STACKIT_SERVICE_ACCOUNT_EMAIL string // Deprecated: ServiceAccountEmail is not required and will be removed after 12th June 2025. + STACKIT_SERVICE_ACCOUNT_TOKEN string + STACKIT_SERVICE_ACCOUNT_KEY_PATH string + STACKIT_PRIVATE_KEY_PATH string + STACKIT_SERVICE_ACCOUNT_KEY string + STACKIT_PRIVATE_KEY string +} + +const ( + credentialsFilePath = ".stackit/credentials.json" //nolint:gosec // linter false positive + tokenCredentialType credentialType = "token" + serviceAccountKeyCredentialType credentialType = "service_account_key" + serviceAccountKeyPathCredentialType credentialType = "service_account_key_path" + privateKeyCredentialType credentialType = "private_key" + privateKeyPathCredentialType credentialType = "private_key_path" +) + +var userHomeDir = os.UserHomeDir + +// SetupAuth sets up authentication based on the configuration. The different options are +// custom authentication, no authentication, explicit key flow, explicit token flow or default authentication +func SetupAuth(cfg *config.Configuration) (rt http.RoundTripper, err error) { + if cfg == nil { + cfg = &config.Configuration{} + email := getServiceAccountEmail(cfg) + cfg.ServiceAccountEmail = email + } + + if cfg.CustomAuth != nil { + return cfg.CustomAuth, nil + } else if cfg.NoAuth { + noAuthRoundTripper, err := NoAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring no auth client: %w", err) + } + return noAuthRoundTripper, nil + } else if cfg.ServiceAccountKey != "" || cfg.ServiceAccountKeyPath != "" { + keyRoundTripper, err := KeyAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring key authentication: %w", err) + } + return keyRoundTripper, nil + } else if cfg.Token != "" { + tokenRoundTripper, err := TokenAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring token authentication: %w", err) + } + return tokenRoundTripper, nil + } + authRoundTripper, err := DefaultAuth(cfg) + if err != nil { + return nil, fmt.Errorf("configuring default authentication: %w", err) + } + return authRoundTripper, nil +} + +// DefaultAuth will search for a valid service account key or token in several locations. +// It will first try to use the key flow, by looking into the variables STACKIT_SERVICE_ACCOUNT_KEY, STACKIT_SERVICE_ACCOUNT_KEY_PATH, +// STACKIT_PRIVATE_KEY and STACKIT_PRIVATE_KEY_PATH. If the keys cannot be retrieved, it will check the credentials file located in STACKIT_CREDENTIALS_PATH, if specified, or in +// $HOME/.stackit/credentials.json as a fallback. If the key are found and are valid, the KeyAuth flow is used. +// If the key flow cannot be used, it will try to find a token in the STACKIT_SERVICE_ACCOUNT_TOKEN. If not present, it will +// search in the credentials file. If the token is found, the TokenAuth flow is used. +// DefaultAuth returns an http.RoundTripper that can be used to make authenticated requests. +// In case the token is not found, DefaultAuth fails. +func DefaultAuth(cfg *config.Configuration) (rt http.RoundTripper, err error) { + if cfg == nil { + cfg = &config.Configuration{} + } + + // Key flow + rt, err = KeyAuth(cfg) + if err != nil { + keyFlowErr := err + // Token flow + rt, err = TokenAuth(cfg) + if err != nil { + return nil, fmt.Errorf("no valid credentials were found: trying key flow: %s, trying token flow: %w", keyFlowErr.Error(), err) + } + } + return rt, nil +} + +// NoAuth configures a flow without authentication and returns an http.RoundTripper +// that can be used to make unauthenticated requests +func NoAuth(cfgs ...*config.Configuration) (rt http.RoundTripper, err error) { + noAuthConfig := clients.NoAuthFlowConfig{} + noAuthRoundTripper := &clients.NoAuthFlow{} + + var cfg *config.Configuration + + if len(cfgs) > 0 { + cfg = cfgs[0] + } else { + cfg = &config.Configuration{} + } + + if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil { + noAuthConfig.HTTPTransport = cfg.HTTPClient.Transport + } + + if err := noAuthRoundTripper.Init(noAuthConfig); err != nil { + return nil, fmt.Errorf("initializing client: %w", err) + } + return noAuthRoundTripper, nil +} + +// TokenAuth configures the token flow and returns an http.RoundTripper +// that can be used to make authenticated requests using a token +func TokenAuth(cfg *config.Configuration) (http.RoundTripper, error) { + // Check token + if cfg.Token == "" { + token, tokenSet := os.LookupEnv("STACKIT_SERVICE_ACCOUNT_TOKEN") + if !tokenSet || token == "" { + credentials, err := readCredentialsFile(cfg.CredentialsFilePath) + if err != nil { + return nil, fmt.Errorf("reading from credentials file: %w", err) + } + token, err = readCredential(tokenCredentialType, credentials) + if err != nil { + return nil, fmt.Errorf("STACKIT_SERVICE_ACCOUNT_TOKEN not set. Trying to read from credentials file: %w", err) + } + } + cfg.Token = token + } + + tokenCfg := clients.TokenFlowConfig{ + ServiceAccountToken: cfg.Token, + } + + if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil { + tokenCfg.HTTPTransport = cfg.HTTPClient.Transport + } + + client := &clients.TokenFlow{} + if err := client.Init(&tokenCfg); err != nil { + return nil, fmt.Errorf("error initializing client: %w", err) + } + + return client, nil +} + +// KeyAuth configures the key flow and returns an http.RoundTripper +// that can be used to make authenticated requests using an access token +// The KeyFlow requires a service account key and a private key. +// +// If the private key is not provided explicitly, KeyAuth will check if there is one included +// in the service account key and use that one. An explicitly provided private key takes +// precedence over the one on the service account key. +func KeyAuth(cfg *config.Configuration) (http.RoundTripper, error) { + err := getServiceAccountKey(cfg) + if err != nil { + return nil, fmt.Errorf("configuring key authentication: service account key could not be found: %w", err) + } + + // Unmarshal service account key to check if private key is present + var serviceAccountKey = &clients.ServiceAccountKeyResponse{} + err = json.Unmarshal([]byte(cfg.ServiceAccountKey), serviceAccountKey) + if err != nil { + return nil, fmt.Errorf("unmarshalling service account key: %w", err) + } + + // Try to get private key from configuration, environment or credentials file + err = getPrivateKey(cfg) + if err != nil { + // If the private key is not provided explicitly, try to extract private key from the service account key + // and use it if present + var extractedPrivateKey string + if serviceAccountKey.Credentials != nil && serviceAccountKey.Credentials.PrivateKey != nil { + extractedPrivateKey = *serviceAccountKey.Credentials.PrivateKey + } + if extractedPrivateKey == "" { + return nil, fmt.Errorf("configuring key authentication: private key is not part of the service account key and could not be found: %w", err) + } + cfg.PrivateKey = extractedPrivateKey + } + + if cfg.TokenCustomUrl == "" { + tokenCustomUrl, tokenUrlSet := os.LookupEnv("STACKIT_TOKEN_BASEURL") + if tokenUrlSet { + cfg.TokenCustomUrl = tokenCustomUrl + } + } + + keyCfg := clients.KeyFlowConfig{ + ServiceAccountKey: serviceAccountKey, + PrivateKey: cfg.PrivateKey, + TokenUrl: cfg.TokenCustomUrl, + BackgroundTokenRefreshContext: cfg.BackgroundTokenRefreshContext, + } + + if cfg.HTTPClient != nil && cfg.HTTPClient.Transport != nil { + keyCfg.HTTPTransport = cfg.HTTPClient.Transport + } + + client := &clients.KeyFlow{} + if err := client.Init(&keyCfg); err != nil { + return nil, fmt.Errorf("error initializing client: %w", err) + } + + return client, nil +} + +// readCredentialsFile reads the credentials file from the specified path and returns Credentials +func readCredentialsFile(path string) (*Credentials, error) { + if path == "" { + customPath, customPathSet := os.LookupEnv("STACKIT_CREDENTIALS_PATH") + if !customPathSet || customPath == "" { + path = credentialsFilePath + home, err := userHomeDir() + if err != nil { + return nil, fmt.Errorf("getting home directory: %w", err) + } + path = filepath.Join(home, path) + } else { + path = customPath + } + } + + credentialsRaw, err := os.ReadFile(path) + if err != nil { + return nil, fmt.Errorf("opening file: %w", err) + } + + var credentials Credentials + err = json.Unmarshal(credentialsRaw, &credentials) + if err != nil { + return nil, fmt.Errorf("unmaPrivateKeyrshalling credentials: %w", err) + } + return &credentials, nil +} + +// readCredential reads the specified credentialType from Credentials and returns it as a string +func readCredential(cred credentialType, credentials *Credentials) (string, error) { + var credentialValue string + switch cred { + case tokenCredentialType: + credentialValue = credentials.STACKIT_SERVICE_ACCOUNT_TOKEN + if credentialValue == "" { + return credentialValue, fmt.Errorf("token is empty or not set") + } + case serviceAccountKeyPathCredentialType: + credentialValue = credentials.STACKIT_SERVICE_ACCOUNT_KEY_PATH + if credentialValue == "" { + return credentialValue, fmt.Errorf("service account key path is empty or not set") + } + case privateKeyPathCredentialType: + credentialValue = credentials.STACKIT_PRIVATE_KEY_PATH + if credentialValue == "" { + return credentialValue, fmt.Errorf("private key path is empty or not set") + } + case serviceAccountKeyCredentialType: + credentialValue = credentials.STACKIT_SERVICE_ACCOUNT_KEY + if credentialValue == "" { + return credentialValue, fmt.Errorf("service account key is empty or not set") + } + case privateKeyCredentialType: + credentialValue = credentials.STACKIT_PRIVATE_KEY + if credentialValue == "" { + return credentialValue, fmt.Errorf("private key is empty or not set") + } + default: + return "", fmt.Errorf("invalid credential type: %s", cred) + } + + return credentialValue, nil +} + +// getServiceAccountEmail searches for an email in the following order: client configuration, environment variable, credentials file. +// is not required for authentication, so it can be empty. +// +// Deprecated: ServiceAccountEmail is not required and will be removed after 12th June 2025. +func getServiceAccountEmail(cfg *config.Configuration) string { + if cfg.ServiceAccountEmail != "" { + return cfg.ServiceAccountEmail + } + + email, emailSet := os.LookupEnv("STACKIT_SERVICE_ACCOUNT_EMAIL") + if !emailSet || email == "" { + credentials, err := readCredentialsFile(cfg.CredentialsFilePath) + if err != nil { + // email is not required for authentication, so it shouldnt block it + return "" + } + return credentials.STACKIT_SERVICE_ACCOUNT_EMAIL + } + return email +} + +// getKey searches for a key in the following order: client configuration, environment variable, credentials file. +func getKey(cfgKey, cfgKeyPath *string, envVarKeyPath, envVarKey string, credTypePath, credTypeKey credentialType, cfgCredFilePath string) error { + if *cfgKey != "" { + return nil + } + if *cfgKeyPath == "" { + // check environment variable: path + keyPath, keyPathSet := os.LookupEnv(envVarKeyPath) + // check environment variable: key + key, keySet := os.LookupEnv(envVarKey) + // if both are not set -> read from credentials file + if (!keyPathSet || keyPath == "") && (!keySet || key == "") { + credentials, err := readCredentialsFile(cfgCredFilePath) + if err != nil { + return fmt.Errorf("reading from credentials file: %w", err) + } + // read key path from credentials file + keyPath, err = readCredential(credTypePath, credentials) + if err != nil || keyPath == "" { + // key path was not provided, read key from credentials file + key, err = readCredential(credTypeKey, credentials) + if err != nil || key == "" { + return fmt.Errorf("neither key nor path is provided in the configuration, environment variable, or credentials file: %w", err) + } + *cfgKey = key + return nil + } + } else if !keyPathSet || keyPath == "" { + // key path was not provided, use key + *cfgKey = key + return nil + } + *cfgKeyPath = keyPath + } + keyBytes, err := os.ReadFile(*cfgKeyPath) + if err != nil { + return fmt.Errorf("reading key from file path: %w", err) + } + if len(keyBytes) == 0 { + return fmt.Errorf("key path points to an empty file") + } + *cfgKey = string(keyBytes) + return nil +} + +// getServiceAccountKey configures the service account key in the provided configuration +func getServiceAccountKey(cfg *config.Configuration) error { + return getKey(&cfg.ServiceAccountKey, &cfg.ServiceAccountKeyPath, "STACKIT_SERVICE_ACCOUNT_KEY_PATH", "STACKIT_SERVICE_ACCOUNT_KEY", serviceAccountKeyPathCredentialType, serviceAccountKeyCredentialType, cfg.CredentialsFilePath) +} + +// getPrivateKey configures the private key in the provided configuration +func getPrivateKey(cfg *config.Configuration) error { + return getKey(&cfg.PrivateKey, &cfg.PrivateKeyPath, "STACKIT_PRIVATE_KEY_PATH", "STACKIT_PRIVATE_KEY", privateKeyPathCredentialType, privateKeyCredentialType, cfg.CredentialsFilePath) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/clients.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/clients.go new file mode 100644 index 00000000..9d7fed6d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/clients.go @@ -0,0 +1,22 @@ +package clients + +import ( + "time" +) + +const ( + DefaultClientTimeout = time.Minute +) + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. +type RetryConfig struct { + MaxRetries int // Max retries + WaitBetweenCalls time.Duration // Time to wait between requests + RetryTimeout time.Duration // Max time to re-try + ClientTimeout time.Duration // HTTP Client timeout +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. +func NewRetryConfig() *RetryConfig { + return &RetryConfig{} +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/doc.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/doc.go new file mode 100644 index 00000000..a60f3d4b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/doc.go @@ -0,0 +1,6 @@ +/* +This package is a fork from the Community STACKIT Go Client + +See: https://github.com/SchwarzIT/community-stackit-go-client +*/ +package clients diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow.go new file mode 100644 index 00000000..58977431 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow.go @@ -0,0 +1,426 @@ +package clients + +import ( + "context" + "crypto/rsa" + "crypto/x509" + "encoding/json" + "encoding/pem" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "regexp" + "strings" + "sync" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" + + "github.com/golang-jwt/jwt/v5" + "github.com/google/uuid" +) + +const ( + // Service Account Key Flow + // Auth flow env variables + ServiceAccountKey = "STACKIT_SERVICE_ACCOUNT_KEY" + PrivateKey = "STACKIT_PRIVATE_KEY" + ServiceAccountKeyPath = "STACKIT_SERVICE_ACCOUNT_KEY_PATH" + PrivateKeyPath = "STACKIT_PRIVATE_KEY_PATH" + tokenAPI = "https://service-account.api.stackit.cloud/token" //nolint:gosec // linter false positive + defaultTokenType = "Bearer" + defaultScope = "" + + defaultTokenExpirationLeeway = time.Second * 5 +) + +// KeyFlow handles auth with SA key +type KeyFlow struct { + rt http.RoundTripper + authClient *http.Client + config *KeyFlowConfig + key *ServiceAccountKeyResponse + privateKey *rsa.PrivateKey + privateKeyPEM []byte + + tokenMutex sync.RWMutex + token *TokenResponseBody + + // If the current access token would expire in less than TokenExpirationLeeway, + // the client will refresh it early to prevent clock skew or other timing issues. + tokenExpirationLeeway time.Duration +} + +// KeyFlowConfig is the flow config +type KeyFlowConfig struct { + ServiceAccountKey *ServiceAccountKeyResponse + PrivateKey string + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. + ClientRetry *RetryConfig + TokenUrl string + BackgroundTokenRefreshContext context.Context // Functionality is enabled if this isn't nil + HTTPTransport http.RoundTripper + AuthHTTPClient *http.Client +} + +// TokenResponseBody is the API response +// when requesting a new token +type TokenResponseBody struct { + AccessToken string `json:"access_token"` + ExpiresIn int `json:"expires_in"` + RefreshToken string `json:"refresh_token"` + Scope string `json:"scope"` + TokenType string `json:"token_type"` +} + +// ServiceAccountKeyResponse is the API response +// when creating a new SA key +type ServiceAccountKeyResponse struct { + Active bool `json:"active"` + CreatedAt time.Time `json:"createdAt"` + Credentials *ServiceAccountKeyCredentials `json:"credentials"` + ID uuid.UUID `json:"id"` + KeyAlgorithm string `json:"keyAlgorithm"` + KeyOrigin string `json:"keyOrigin"` + KeyType string `json:"keyType"` + PublicKey string `json:"publicKey"` + ValidUntil *time.Time `json:"validUntil,omitempty"` +} + +type ServiceAccountKeyCredentials struct { + Aud string `json:"aud"` + Iss string `json:"iss"` + Kid string `json:"kid"` + PrivateKey *string `json:"privateKey,omitempty"` + Sub uuid.UUID `json:"sub"` +} + +// GetConfig returns the flow configuration +func (c *KeyFlow) GetConfig() KeyFlowConfig { + if c.config == nil { + return KeyFlowConfig{} + } + return *c.config +} + +// GetServiceAccountEmail returns the service account email +func (c *KeyFlow) GetServiceAccountEmail() string { + if c.key == nil { + return "" + } + return c.key.Credentials.Iss +} + +// GetToken returns the token field +func (c *KeyFlow) GetToken() TokenResponseBody { + c.tokenMutex.RLock() + defer c.tokenMutex.RUnlock() + + if c.token == nil { + return TokenResponseBody{} + } + // Returned struct is passed by value (because it's a struct) + // So no deepy copy needed + return *c.token +} + +func (c *KeyFlow) Init(cfg *KeyFlowConfig) error { + // No concurrency at this point, so no mutex check needed + c.token = &TokenResponseBody{} + c.config = cfg + + if c.config.TokenUrl == "" { + c.config.TokenUrl = tokenAPI + } + + c.tokenExpirationLeeway = defaultTokenExpirationLeeway + + if c.rt = cfg.HTTPTransport; c.rt == nil { + c.rt = http.DefaultTransport + } + + if c.authClient = cfg.AuthHTTPClient; cfg.AuthHTTPClient == nil { + c.authClient = &http.Client{ + Transport: c.rt, + Timeout: DefaultClientTimeout, + } + } + + err := c.validate() + if err != nil { + return err + } + if c.config.BackgroundTokenRefreshContext != nil { + go continuousRefreshToken(c) + } + return nil +} + +// SetToken can be used to set an access and refresh token manually in the client. +// The other fields in the token field are determined by inspecting the token or setting default values. +func (c *KeyFlow) SetToken(accessToken, refreshToken string) error { + // We can safely use ParseUnverified because we are not authenticating the user, + // We are parsing the token just to get the expiration time claim + parsedAccessToken, _, err := jwt.NewParser().ParseUnverified(accessToken, &jwt.RegisteredClaims{}) + if err != nil { + return fmt.Errorf("parse access token to read expiration time: %w", err) + } + exp, err := parsedAccessToken.Claims.GetExpirationTime() + if err != nil { + return fmt.Errorf("get expiration time from access token: %w", err) + } + + c.tokenMutex.Lock() + c.token = &TokenResponseBody{ + AccessToken: accessToken, + ExpiresIn: int(exp.Time.Unix()), + Scope: defaultScope, + RefreshToken: refreshToken, + TokenType: defaultTokenType, + } + c.tokenMutex.Unlock() + return nil +} + +// Roundtrip performs the request +func (c *KeyFlow) RoundTrip(req *http.Request) (*http.Response, error) { + if c.rt == nil { + return nil, fmt.Errorf("please run Init()") + } + + accessToken, err := c.GetAccessToken() + if err != nil { + return nil, err + } + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", accessToken)) + return c.rt.RoundTrip(req) +} + +// GetAccessToken returns a short-lived access token and saves the access and refresh tokens in the token field +func (c *KeyFlow) GetAccessToken() (string, error) { + if c.rt == nil { + return "", fmt.Errorf("nil http round tripper, please run Init()") + } + + var accessToken string + + c.tokenMutex.RLock() + if c.token != nil { + accessToken = c.token.AccessToken + } + c.tokenMutex.RUnlock() + + accessTokenExpired, err := tokenExpired(accessToken, c.tokenExpirationLeeway) + if err != nil { + return "", fmt.Errorf("check access token is expired: %w", err) + } + if !accessTokenExpired { + return accessToken, nil + } + if err = c.recreateAccessToken(); err != nil { + var oapiErr *oapierror.GenericOpenAPIError + if ok := errors.As(err, &oapiErr); ok { + reg := regexp.MustCompile("Key with kid .*? was not found") + if reg.Match(oapiErr.Body) { + err = fmt.Errorf("check if your configured key is valid and if the token endpoint is configured correct: %w", err) + } + } + return "", fmt.Errorf("get new access token: %w", err) + } + + c.tokenMutex.RLock() + accessToken = c.token.AccessToken + c.tokenMutex.RUnlock() + + return accessToken, nil +} + +// validate the client is configured well +func (c *KeyFlow) validate() error { + if c.config.ServiceAccountKey == nil { + return fmt.Errorf("service account access key cannot be empty") + } + if c.config.PrivateKey == "" { + return fmt.Errorf("private key cannot be empty") + } + + c.key = c.config.ServiceAccountKey + var err error + c.privateKey, err = jwt.ParseRSAPrivateKeyFromPEM([]byte(c.config.PrivateKey)) + if err != nil { + return fmt.Errorf("parse private key from PEM file: %w", err) + } + + // Encode the private key in PEM format + privKeyPEM := &pem.Block{ + Type: "RSA PRIVATE KEY", + Bytes: x509.MarshalPKCS1PrivateKey(c.privateKey), + } + c.privateKeyPEM = pem.EncodeToMemory(privKeyPEM) + + if c.tokenExpirationLeeway < 0 { + return fmt.Errorf("token expiration leeway cannot be negative") + } + + return nil +} + +// Flow auth functions + +// recreateAccessToken is used to create a new access token +// when the existing one isn't valid anymore +func (c *KeyFlow) recreateAccessToken() error { + var refreshToken string + + c.tokenMutex.RLock() + if c.token != nil { + refreshToken = c.token.RefreshToken + } + c.tokenMutex.RUnlock() + + refreshTokenExpired, err := tokenExpired(refreshToken, c.tokenExpirationLeeway) + if err != nil { + return err + } + if !refreshTokenExpired { + return c.createAccessTokenWithRefreshToken() + } + return c.createAccessToken() +} + +// createAccessToken creates an access token using self signed JWT +func (c *KeyFlow) createAccessToken() (err error) { + grant := "urn:ietf:params:oauth:grant-type:jwt-bearer" + assertion, err := c.generateSelfSignedJWT() + if err != nil { + return err + } + res, err := c.requestToken(grant, assertion) + if err != nil { + return err + } + defer func() { + tempErr := res.Body.Close() + if tempErr != nil && err == nil { + err = fmt.Errorf("close request access token response: %w", tempErr) + } + }() + return c.parseTokenResponse(res) +} + +// createAccessTokenWithRefreshToken creates an access token using +// an existing pre-validated refresh token +func (c *KeyFlow) createAccessTokenWithRefreshToken() (err error) { + c.tokenMutex.RLock() + refreshToken := c.token.RefreshToken + c.tokenMutex.RUnlock() + + res, err := c.requestToken("refresh_token", refreshToken) + if err != nil { + return err + } + defer func() { + tempErr := res.Body.Close() + if tempErr != nil && err == nil { + err = fmt.Errorf("close request access token with refresh token response: %w", tempErr) + } + }() + return c.parseTokenResponse(res) +} + +// generateSelfSignedJWT generates JWT token +func (c *KeyFlow) generateSelfSignedJWT() (string, error) { + claims := jwt.MapClaims{ + "iss": c.key.Credentials.Iss, + "sub": c.key.Credentials.Sub, + "jti": uuid.New(), + "aud": c.key.Credentials.Aud, + "iat": jwt.NewNumericDate(time.Now()), + "exp": jwt.NewNumericDate(time.Now().Add(10 * time.Minute)), + } + token := jwt.NewWithClaims(jwt.SigningMethodRS512, claims) + token.Header["kid"] = c.key.Credentials.Kid + tokenString, err := token.SignedString(c.privateKey) + if err != nil { + return "", err + } + return tokenString, nil +} + +// requestToken makes a request to the SA token API +func (c *KeyFlow) requestToken(grant, assertion string) (*http.Response, error) { + body := url.Values{} + body.Set("grant_type", grant) + if grant == "refresh_token" { + body.Set("refresh_token", assertion) + } else { + body.Set("assertion", assertion) + } + payload := strings.NewReader(body.Encode()) + req, err := http.NewRequest(http.MethodPost, c.config.TokenUrl, payload) + if err != nil { + return nil, err + } + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + + return c.authClient.Do(req) +} + +// parseTokenResponse parses the response from the server +func (c *KeyFlow) parseTokenResponse(res *http.Response) error { + if res == nil { + return fmt.Errorf("received bad response from API") + } + if res.StatusCode != http.StatusOK { + body, err := io.ReadAll(res.Body) + if err != nil { + // Fail silently, omit body from error + // We're trying to show error details, so it's unnecessary to fail because of this err + body = []byte{} + } + return &oapierror.GenericOpenAPIError{ + StatusCode: res.StatusCode, + Body: body, + } + } + body, err := io.ReadAll(res.Body) + if err != nil { + return err + } + + c.tokenMutex.Lock() + c.token = &TokenResponseBody{} + err = json.Unmarshal(body, c.token) + c.tokenMutex.Unlock() + if err != nil { + return fmt.Errorf("unmarshal token response: %w", err) + } + + return nil +} + +func tokenExpired(token string, tokenExpirationLeeway time.Duration) (bool, error) { + if token == "" { + return true, nil + } + + // We can safely use ParseUnverified because we are not authenticating the user at this point. + // We're just checking the expiration time + tokenParsed, _, err := jwt.NewParser().ParseUnverified(token, &jwt.RegisteredClaims{}) + if err != nil { + return false, fmt.Errorf("parse token: %w", err) + } + + expirationTimestampNumeric, err := tokenParsed.Claims.GetExpirationTime() + if err != nil { + return false, fmt.Errorf("get expiration timestamp: %w", err) + } + + // Pretend to be `tokenExpirationLeeway` into the future to avoid token expiring + // between retrieving the token and upstream systems validating it. + now := time.Now().Add(tokenExpirationLeeway) + + return now.After(expirationTimestampNumeric.Time), nil +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow_continuous_refresh.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow_continuous_refresh.go new file mode 100644 index 00000000..f5129aa0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/key_flow_continuous_refresh.go @@ -0,0 +1,142 @@ +package clients + +import ( + "errors" + "fmt" + "os" + "time" + + "github.com/golang-jwt/jwt/v5" + + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +var ( + defaultTimeStartBeforeTokenExpiration = 30 * time.Minute + defaultTimeBetweenContextCheck = time.Second + defaultTimeBetweenTries = 5 * time.Minute +) + +// Continuously refreshes the token of a key flow, retrying if the token API returns 5xx errrors. Writes to stderr when it terminates. +// +// To terminate this routine, close the context in keyFlow.config.BackgroundTokenRefreshContext. +func continuousRefreshToken(keyflow *KeyFlow) { + refresher := &continuousTokenRefresher{ + keyFlow: keyflow, + timeStartBeforeTokenExpiration: defaultTimeStartBeforeTokenExpiration, + timeBetweenContextCheck: defaultTimeBetweenContextCheck, + timeBetweenTries: defaultTimeBetweenTries, + } + err := refresher.continuousRefreshToken() + fmt.Fprintf(os.Stderr, "Token refreshing terminated: %v", err) +} + +type continuousTokenRefresher struct { + keyFlow *KeyFlow + // Token refresh tries start at [Access token expiration timestamp] - [This duration] + timeStartBeforeTokenExpiration time.Duration + timeBetweenContextCheck time.Duration + timeBetweenTries time.Duration +} + +// Continuously refreshes the token of a key flow, retrying if the token API returns 5xx errrors. Always returns with a non-nil error. +// +// To terminate this routine, close the context in refresher.keyFlow.config.BackgroundTokenRefreshContext. +func (refresher *continuousTokenRefresher) continuousRefreshToken() error { + // Compute timestamp where we'll refresh token + // Access token may be empty at this point, we have to check it + var startRefreshTimestamp time.Time + var accessToken string + + refresher.keyFlow.tokenMutex.RLock() + if refresher.keyFlow.token != nil { + accessToken = refresher.keyFlow.token.AccessToken + } + refresher.keyFlow.tokenMutex.RUnlock() + if accessToken == "" { + startRefreshTimestamp = time.Now() + } else { + expirationTimestamp, err := refresher.getAccessTokenExpirationTimestamp() + if err != nil { + return fmt.Errorf("get access token expiration timestamp: %w", err) + } + startRefreshTimestamp = expirationTimestamp.Add(-refresher.timeStartBeforeTokenExpiration) + } + + for { + err := refresher.waitUntilTimestamp(startRefreshTimestamp) + if err != nil { + return err + } + + err = refresher.keyFlow.config.BackgroundTokenRefreshContext.Err() + if err != nil { + return fmt.Errorf("check context: %w", err) + } + + ok, err := refresher.refreshToken() + if err != nil { + return fmt.Errorf("refresh tokens: %w", err) + } + if !ok { + startRefreshTimestamp = startRefreshTimestamp.Add(refresher.timeBetweenTries) + continue + } + + expirationTimestamp, err := refresher.getAccessTokenExpirationTimestamp() + if err != nil { + return fmt.Errorf("get access token expiration timestamp: %w", err) + } + startRefreshTimestamp = expirationTimestamp.Add(-refresher.timeStartBeforeTokenExpiration) + } +} + +func (refresher *continuousTokenRefresher) getAccessTokenExpirationTimestamp() (*time.Time, error) { + refresher.keyFlow.tokenMutex.RLock() + token := refresher.keyFlow.token.AccessToken + refresher.keyFlow.tokenMutex.RUnlock() + + // We can safely use ParseUnverified because we are not doing authentication of any kind + // We're just checking the expiration time + tokenParsed, _, err := jwt.NewParser().ParseUnverified(token, &jwt.RegisteredClaims{}) + if err != nil { + return nil, fmt.Errorf("parse token: %w", err) + } + expirationTimestampNumeric, err := tokenParsed.Claims.GetExpirationTime() + if err != nil { + return nil, fmt.Errorf("get expiration timestamp: %w", err) + } + return &expirationTimestampNumeric.Time, nil +} + +func (refresher *continuousTokenRefresher) waitUntilTimestamp(timestamp time.Time) error { + for time.Now().Before(timestamp) { + err := refresher.keyFlow.config.BackgroundTokenRefreshContext.Err() + if err != nil { + return fmt.Errorf("check context: %w", err) + } + time.Sleep(refresher.timeBetweenContextCheck) + } + return nil +} + +// Returns: +// - (true, nil) if successful. +// - (false, nil) if not successful but should be retried. +// - (_, err) if not successful and shouldn't be retried. +func (refresher *continuousTokenRefresher) refreshToken() (bool, error) { + err := refresher.keyFlow.recreateAccessToken() + if err == nil { + return true, nil + } + + // Should be retried if this is an API error with status code 5xx + oapiErr := &oapierror.GenericOpenAPIError{} + if !errors.As(err, &oapiErr) { + return false, err + } + if oapiErr.StatusCode < 500 { + return false, err + } + return false, nil +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/no_auth_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/no_auth_flow.go new file mode 100644 index 00000000..b0b2406c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/no_auth_flow.go @@ -0,0 +1,45 @@ +package clients + +import ( + "fmt" + "net/http" +) + +type NoAuthFlow struct { + rt http.RoundTripper + config *NoAuthFlowConfig +} + +// NoAuthFlowConfig holds the configuration for the unauthenticated flow +type NoAuthFlowConfig struct { + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. + ClientRetry *RetryConfig + HTTPTransport http.RoundTripper +} + +// GetConfig returns the flow configuration +func (c *NoAuthFlow) GetConfig() NoAuthFlowConfig { + if c.config == nil { + return NoAuthFlowConfig{} + } + return *c.config +} + +func (c *NoAuthFlow) Init(cfg NoAuthFlowConfig) error { + c.config = &NoAuthFlowConfig{} + + if c.rt = cfg.HTTPTransport; c.rt == nil { + c.rt = http.DefaultTransport + } + + return nil +} + +// RoundTrip performs the request +func (c *NoAuthFlow) RoundTrip(req *http.Request) (*http.Response, error) { + if c.rt == nil { + return nil, fmt.Errorf("please run Init()") + } + + return c.rt.RoundTrip(req) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/token_flow.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/token_flow.go new file mode 100644 index 00000000..ac1ff779 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/clients/token_flow.go @@ -0,0 +1,63 @@ +package clients + +import ( + "fmt" + "net/http" +) + +const ( + // Service Account Token Flow + // Auth flow env variables + ServiceAccountToken = "STACKIT_SERVICE_ACCOUNT_TOKEN" +) + +// TokenFlow handles auth with SA static token +type TokenFlow struct { + rt http.RoundTripper + config *TokenFlowConfig +} + +// TokenFlowConfig is the flow config +type TokenFlowConfig struct { + // Deprecated: ServiceAccountEmail is not required and will be removed after 12th June 2025. + ServiceAccountEmail string + ServiceAccountToken string + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. + ClientRetry *RetryConfig + HTTPTransport http.RoundTripper +} + +// GetConfig returns the flow configuration +func (c *TokenFlow) GetConfig() TokenFlowConfig { + if c.config == nil { + return TokenFlowConfig{} + } + return *c.config +} + +func (c *TokenFlow) Init(cfg *TokenFlowConfig) error { + c.config = cfg + + if c.rt = cfg.HTTPTransport; c.rt == nil { + c.rt = http.DefaultTransport + } + + return c.validate() +} + +// validate the client is configured well +func (c *TokenFlow) validate() error { + if c.config.ServiceAccountToken == "" { + return fmt.Errorf("service account access token cannot be empty") + } + return nil +} + +// RoundTrip performs the request +func (c *TokenFlow) RoundTrip(req *http.Request) (*http.Response, error) { + if c.rt == nil { + return nil, fmt.Errorf("please run Init()") + } + req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.config.ServiceAccountToken)) + return c.rt.RoundTrip(req) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/config/config.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/config/config.go new file mode 100644 index 00000000..93002c02 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/config/config.go @@ -0,0 +1,567 @@ +// Part of this code is taken from the client.go file +// generated by the OpenApi generator for each API client +package config + +import ( + "context" + "fmt" + "net/http" + "os" + "strings" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/clients" +) + +const ( + global = "global" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). +type contextKey string + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") + + // ContextHTTPResponse holds the raw HTTP response after the request has completed. + ContextHTTPResponse = contextKey("httpResponse") + + // ContextHTTPRequest holds the raw HTTP request. + ContextHTTPRequest = contextKey("httpRequest") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// Middleware is a function that wraps an http.RoundTripper to provide additional functionality +// such as logging, authentication, etc. +type Middleware func(http.RoundTripper) http.RoundTripper + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + NoAuth bool `json:"noAuth,omitempty"` + ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"` // Deprecated: ServiceAccountEmail is not required and will be removed after 12th June 2025. + Token string `json:"token,omitempty"` + ServiceAccountKey string `json:"serviceAccountKey,omitempty"` + PrivateKey string `json:"privateKey,omitempty"` + ServiceAccountKeyPath string `json:"serviceAccountKeyPath,omitempty"` + PrivateKeyPath string `json:"privateKeyPath,omitempty"` + CredentialsFilePath string `json:"credentialsFilePath,omitempty"` + TokenCustomUrl string `json:"tokenCustomUrl,omitempty"` + Region string `json:"region,omitempty"` + CustomAuth http.RoundTripper + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client + Middleware []Middleware + + // If != nil, a goroutine will be launched that will refresh the service account's access token when it's close to being expired. + // The goroutine is killed whenever this context is canceled. + // + // Only has effect for key flow + BackgroundTokenRefreshContext context.Context + + // Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This field has no effect, and will be removed in a later update + RetryOptions *clients.RetryConfig //nolint:staticcheck //will be removed in a later update + + setCustomEndpoint bool +} + +// ConfigurationOption is an option for an API client. The options are executed sequentially, so +// if you use withHTTPClient with a custom client that has a timeout of 1 minute and then you use +// withTimeout with a timeout of 2 minutes, the HTTP client timeout will be last one to be set. +// In the same way, if you use withHTTPClient as the last option, it will override all of the +// previous configurations to the HTTPClient +type ConfigurationOption func(*Configuration) error + +// WithHTTPClient returns a ConfigurationOption that specifies the HTTP client to use +// as basis for the communication. +// Warning: providing this option overrides authentication, if you just want to customize the http client parameters except Transport, +// you can use the WithCheckRedirect, WithJar and WithTimeout +func WithHTTPClient(client *http.Client) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient = client + return nil + } +} + +// WithCustomAuth returns a ConfigurationOption that provides a custom http.Roundtripper +// for making authenticated requests +func WithCustomAuth(rt http.RoundTripper) ConfigurationOption { + return func(config *Configuration) error { + config.CustomAuth = rt + return nil + } +} + +// WithUserAgent returns a ConfigurationOption that defines the User-Agent +func WithUserAgent(userAgent string) ConfigurationOption { + return func(config *Configuration) error { + config.UserAgent = userAgent + return nil + } +} + +// WithRegion returns a ConfigurationOption that specifies the region to be used +func WithRegion(region string) ConfigurationOption { + return func(config *Configuration) error { + config.Region = region + return nil + } +} + +// WithEndpoint returns a ConfigurationOption that overrides the default endpoint to be used for the client +// This option takes precedence over withRegion +func WithEndpoint(endpoint string) ConfigurationOption { + return func(config *Configuration) error { + customServers := ServerConfigurations{ + { + URL: endpoint, + Description: "User provided URL", + }, + } + config.Servers = customServers + config.setCustomEndpoint = true + return nil + } +} + +// WithTokenEndpoint returns a ConfigurationOption that overrides the default url to be used to get a token when using the key flow +func WithTokenEndpoint(url string) ConfigurationOption { + return func(config *Configuration) error { + config.TokenCustomUrl = url + return nil + } +} + +// WithServiceAccountEmail returns a ConfigurationOption that sets the service account email +// +// Deprecated: WithServiceAccountEmail is not required and will be removed after 12th June 2025. +func WithServiceAccountEmail(serviceAccountEmail string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountEmail = serviceAccountEmail + return nil + } +} + +// WithServiceAccountKey returns a ConfigurationOption that sets the service account key +// This option takes precedence over WithServiceAccountKeyPath +func WithServiceAccountKey(serviceAccountKey string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountKey = serviceAccountKey + return nil + } +} + +// WithServiceAccountKeyPath returns a ConfigurationOption that sets the service account key path +func WithServiceAccountKeyPath(serviceAccountKeyPath string) ConfigurationOption { + return func(config *Configuration) error { + config.ServiceAccountKeyPath = serviceAccountKeyPath + return nil + } +} + +// WithPrivateKey returns a ConfigurationOption that sets the private key +// This option takes precedence over WithPrivateKeyPath +func WithPrivateKey(privateKey string) ConfigurationOption { + return func(config *Configuration) error { + config.PrivateKey = privateKey + return nil + } +} + +// WithPrivateKeyPath returns a ConfigurationOption that sets the private key path +func WithPrivateKeyPath(privateKeyPath string) ConfigurationOption { + return func(config *Configuration) error { + config.PrivateKeyPath = privateKeyPath + return nil + } +} + +// WithRetryTimeout returns a ConfigurationOption that specifies the maximum time for ret +// WithoutAuthentication returns a ConfigurationOption that disables authentication. +// This option takes precedence over the WithToken option +func WithoutAuthentication() ConfigurationOption { + return func(config *Configuration) error { + config.NoAuth = true + return nil + } +} + +// WithToken returns a ConfigurationOption that sets a token to be used for authentication in API calls +func WithToken(token string) ConfigurationOption { + return func(config *Configuration) error { + config.Token = token + return nil + } +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update +func WithMaxRetries(_ int) ConfigurationOption { + return func(_ *Configuration) error { + return nil + } +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update +func WithWaitBetweenCalls(_ time.Duration) ConfigurationOption { + return func(_ *Configuration) error { + return nil + } +} + +// Deprecated: retry options were removed to reduce complexity of the client. If this functionality is needed, you can provide your own custom HTTP client. This option has no effect, and will be removed in a later update +func WithRetryTimeout(_ time.Duration) ConfigurationOption { + return func(_ *Configuration) error { + return nil + } +} + +// WithTimeout returns a ConfigurationOption that specifies the HTTP client timeout +func WithTimeout(timeout time.Duration) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient.Timeout = timeout + return nil + } +} + +// WithCheckRedirect returns a ConfigurationOption that specifies the HTTP client checkRedirect function +func WithCheckRedirect(checkRedirect func(req *http.Request, via []*http.Request) error) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient.CheckRedirect = checkRedirect + return nil + } +} + +// WithJar returns a ConfigurationOption that specifies the HTTP client cookie jar +func WithJar(jar http.CookieJar) ConfigurationOption { + return func(config *Configuration) error { + config.HTTPClient.Jar = jar + return nil + } +} + +// WithMiddleware returns a ConfigurationOption that adds a Middleware to the client. +// The Middleware is prepended to the list of Middlewares so that the last added Middleware is the first to be executed. +// Warning: Providing this option may overide the authentication performed by the SDK if the middlewares provided break the chain. +// If changes are made to the authentication header and the chain is preserved, they will be overwritten. If you wish to overwrite authentication, use WithCustomAuth. +func WithMiddleware(m Middleware) ConfigurationOption { + // Prepend m to the list of middlewares + return func(config *Configuration) error { + config.Middleware = append([]Middleware{m}, config.Middleware...) + return nil + } +} + +// WithBackgroundTokenRefresh returns a ConfigurationOption that enables access token refreshing in backgound. +// +// If enabled, a goroutine will be launched that will refresh the service account's access token when it's close to being expired. +// The goroutine is killed whenever the given context is canceled. +// +// Only has effect for key flow +func WithBackgroundTokenRefresh(ctx context.Context) ConfigurationOption { + return func(c *Configuration) error { + if ctx == nil { + return fmt.Errorf("context for token refresh in background cannot be empty") + } + c.BackgroundTokenRefreshContext = ctx + return nil + } +} + +// WithCustomConfiguration returns a ConfigurationOption that sets a custom Configuration +func WithCustomConfiguration(cfg *Configuration) ConfigurationOption { + return func(config *Configuration) error { + config.Host = cfg.Host + config.Scheme = cfg.Scheme + config.DefaultHeader = cfg.DefaultHeader + config.UserAgent = cfg.UserAgent + config.Debug = cfg.Debug + config.NoAuth = cfg.NoAuth + config.Token = cfg.Token + config.ServiceAccountKey = cfg.ServiceAccountKey + config.ServiceAccountKeyPath = cfg.ServiceAccountKeyPath + config.PrivateKey = cfg.PrivateKey + config.PrivateKeyPath = cfg.PrivateKeyPath + config.Region = cfg.Region + config.CredentialsFilePath = cfg.CredentialsFilePath + config.CustomAuth = cfg.CustomAuth + config.Servers = cfg.Servers + config.setCustomEndpoint = (len(cfg.Servers) > 0) + config.OperationServers = cfg.OperationServers + config.HTTPClient = cfg.HTTPClient + config.BackgroundTokenRefreshContext = cfg.BackgroundTokenRefreshContext + return nil + } +} + +// WithCaptureHTTPResponse adds the raw HTTP response retrieval annotation to the parent context. +// The resp parameter will contain the raw HTTP response after the request has completed. +// +// Deprecated: Use runtime.WithCaptureHTTPResponse instead +func WithCaptureHTTPResponse(parent context.Context, resp **http.Response) context.Context { + return context.WithValue(parent, ContextHTTPResponse, resp) +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + serverUrl := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + serverUrl = strings.Replace(serverUrl, "{"+name+"}", value, -1) + } else { + serverUrl = strings.Replace(serverUrl, "{"+name+"}", variable.DefaultValue, -1) + } + } + return serverUrl, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, fmt.Errorf("invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + operationIndices, ok := osi.(map[string]int) + if !ok { + return 0, fmt.Errorf("invalid type %T should be map[string]int", osi) + } + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, fmt.Errorf("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + operationVariables, ok := osv.(map[string]map[string]string) + if !ok { + return nil, fmt.Errorf("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} + +// ConfigureRegion configures the API server urls with the user specified region. +// Does nothing if a custom endpoint is provided. +// Throws an error if no region is given or if the region is not valid +// Throws an error if a region is given for a global url. +func ConfigureRegion(cfg *Configuration) error { + if cfg.setCustomEndpoint { + return nil + } + + servers := cfg.Servers + oasRegion, ok := servers[0].Variables["region"] + if !ok { + // No region variable found + return fmt.Errorf("no region was found in the API configuration") + } + + var availableRegions []string + for _, regionWithDotSuffix := range oasRegion.EnumValues { + availableRegions = append(availableRegions, strings.TrimSuffix(regionWithDotSuffix, ".")) + } + + isRegionSetByEnv := false + if cfg.Region == "" { + // Check region + envVarRegion, _ := os.LookupEnv("STACKIT_REGION") + cfg.Region = envVarRegion + isRegionSetByEnv = true + } + + if oasRegion.DefaultValue != "" && oasRegion.DefaultValue != global { + if cfg.Region == "" { + return fmt.Errorf("no region was provided, available regions are: %s", availableRegions) + } + // API is regional (not global) + if containsCaseSensitive(availableRegions, cfg.Region) { + cfgUrl := strings.Replace(servers[0].URL, "{region}", fmt.Sprintf("%s.", cfg.Region), -1) + cfg.Servers = ServerConfigurations{ + { + URL: cfgUrl, + Description: servers[0].Description, + }, + } + return nil + } + // Region is not available. + return fmt.Errorf("the provided region is not available for this API, available regions are: %s", availableRegions) + } + // Global API. + // If a region is provided by the user via WithRegion() return an error. + // The region is provided as a function argument instead of being set in the client configuration. + if cfg.Region != "" && !isRegionSetByEnv { + return fmt.Errorf("this API does not support setting a region in the the client configuration, please check if the region can be specified as a function parameter") + } + // If the url is a template, generated using deprecated config.json, the region variable is replaced + // If the url is already configured, there is no region variable and it remains the same + cfgUrl := strings.Replace(servers[0].URL, "{region}", "", -1) + cfg.Servers = ServerConfigurations{ + { + URL: cfgUrl, + Description: servers[0].Description, + }, + } + return nil +} + +// containsCaseSensitive is a case sensitive match, finding needle in a haystack +func containsCaseSensitive(haystack []string, needle string) bool { + for _, a := range haystack { + if needle == a { + return true + } + } + return false +} + +// ChainMiddleware chains multiple middlewares to create a single http.RoundTripper +// The middlewares are applied in reverse order, so the last middleware provided in the arguments is the first to be executed +// If the root http.RoundTripper is nil, http.DefaultTransport is used +func ChainMiddleware(rt http.RoundTripper, middlewares ...Middleware) http.RoundTripper { + if rt == nil { + rt = http.DefaultTransport + } + + // Apply middlewares in reverse order + for i := len(middlewares) - 1; i >= 0; i-- { + rt = middlewares[i](rt) + } + + return rt +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/core/oapierror/oapierror.go b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oapierror/oapierror.go new file mode 100644 index 00000000..205abc17 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/core/oapierror/oapierror.go @@ -0,0 +1,98 @@ +package oapierror + +import ( + "fmt" + "reflect" + "strings" +) + +var ( + // When a response has a bad status, this limits the number of characters that are shown from the response Body + ApiErrorMaxCharacterLimit = 500 +) + +// GenericOpenAPIError Provides access to the Body, errorMessage and Model on returned Errors. +type GenericOpenAPIError struct { + StatusCode int + Body []byte + ErrorMessage string + Model interface{} +} + +func NewError(code int, status string) *GenericOpenAPIError { + return &GenericOpenAPIError{ + StatusCode: code, + ErrorMessage: status, + Model: map[string]any{}, + } +} + +func NewErrorWithBody(code int, status string, body []byte, model any) *GenericOpenAPIError { + return &GenericOpenAPIError{ + StatusCode: code, + ErrorMessage: status, + Body: body, + Model: model, + } +} + +// Error returns non-empty string if there was an errorMessage. +func (e GenericOpenAPIError) Error() string { + // Prevent panic in case of negative value + if ApiErrorMaxCharacterLimit < 0 { + ApiErrorMaxCharacterLimit = 500 + } + + if len(e.Body) <= ApiErrorMaxCharacterLimit { + return fmt.Sprintf("%s, status code %d, Body: %s\n", e.ErrorMessage, e.StatusCode, string(e.Body)) + } + indexStart := ApiErrorMaxCharacterLimit / 2 + indexEnd := len(e.Body) - ApiErrorMaxCharacterLimit/2 + numberTruncatedCharacters := indexEnd - indexStart + return fmt.Sprintf( + "%s, status code %d, Body: %s [...truncated %d characters...] %s", + e.ErrorMessage, + e.StatusCode, + string(e.Body[:indexStart]), + numberTruncatedCharacters, + string(e.Body[indexEnd:]), + ) +} + +// StatusCode returns the status code of the response +func (e GenericOpenAPIError) GetStatusCode() int { + return e.StatusCode +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) GetBody() []byte { + return e.Body +} + +// Model returns the unpacked Model of the errorMessage +func (e GenericOpenAPIError) GetModel() interface{} { + return e.Model +} + +// Format errorMessage message using title and detail when Model implements rfc7807 +func FormatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + switch metaValue.Kind() { + case reflect.Map: + return status + case reflect.Struct: + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + + // status title (detail) + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) + } + return status +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/CHANGELOG.md b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/CHANGELOG.md new file mode 100644 index 00000000..5d3f9e86 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/CHANGELOG.md @@ -0,0 +1,216 @@ +## v1.0.0 +- **Breaking Change:** The region is no longer specified within the client configuration. Instead, the region must be passed as a parameter to any region-specific request. +- **Feature:** Add new methods to manage routing tables: `AddRoutingTableToArea`, `DeleteRoutingTableFromArea`, `GetRoutingTableOfArea`, `ListRoutingTablesOfArea`, `UpdateRoutingTableOfArea` +- **Feature:** Add new methods to manage routes in routing tables: `AddRoutesToRoutingTable`, `DeleteRouteFromRoutingTable`, `GetRouteOfRoutingTable`, `ListRoutesOfRoutingTable`, `UpdateRouteOfRoutingTable` +- **Breaking Change:** Add new method to manage network area regions: `CreateNetworkAreaRegion`, `DeleteNetworkAreaRegion`, `GetNetworkAreaRegion`, `ListNetworkAreaRegions`, `UpdateNetworkAreaRegion` +- **Feature:** Add new wait handler for network area region: `CreateNetworkAreaRegionWaitHandler` and `DeleteRegionalNetworkAreaConfigurationWaitHandler` +- **Breaking Change:** Wait handler which relates to region-specific services, got an additional param for the region: `CreateNetworkWaitHandler`, `UpdateNetworkWaitHandler`, `DeleteNetworkWaitHandler`, `CreateVolumeWaitHandler`, `DeleteVolumeWaitHandler`, `CreateServerWaitHandler`, `ResizeServerWaitHandler`, `DeleteServerWaitHandler`, `StartServerWaitHandler`, `StopServerWaitHandler`, `DeallocateServerWaitHandler`, `RescueServerWaitHandler`, `UnrescueServerWaitHandler`, `ProjectRequestWaitHandler`, `AddVolumeToServerWaitHandler`, `RemoveVolumeFromServerWaitHandler`, `UploadImageWaitHandler`, `DeleteImageWaitHandler`, `CreateBackupWaitHandler`, `DeleteBackupWaitHandler`, `RestoreBackupWaitHandler`, `CreateSnapshotWaitHandler`, `DeleteSnapshotWaitHandler` +- **Breaking Change:** `Network` model has changed: + - `NetworkId` has been renamed to `Id` + - `Gateway`, `Nameservers`, `Prefixes` and `PublicIp` has been moved to new model `NetworkIPv4`, and can be accessed in the new property `IPv4` + - Properties `Gatewayv6`, `Nameserversv6` and `Prefixesv6` moved to new model `NetworkIPv6`, and can be accessed in the new property `IPv6` +- **Breaking Change:** `CreateServerPayload` model has changed: + - Model `CreateServerPayloadBootVolume` of `BootVolume` property changed to `ServerBootVolume` + - Property `Networking` in `CreateServerPayload` is required now +- **Deprecated:** Deprecated wait handler and will be removed after April 2026: `CreateNetworkAreaWaitHandler`, `UpdateNetworkAreaWaitHandler` and `DeleteNetworkAreaWaitHandler` + +## v0.31.0 +- Add `CreatedAt` and `UpdatedAt` fields to `BaseSecurityGroupRule` struct +- Add `Description` field to `CreateNicPayload`, `NIC`, `UpdateNicPayload` structs +- Add `Agent` field to `Server`, `CreateServerPayload` structs +- Add `CreatedAt`, `UpdatedAt` and `Protocol` fields to `SecurityGroupRule`, `CreateSecurityGroupRulePayload` structs +- New struct: `ServerAgent` + +## v0.30.0 +- **Feature:** Add waiter to wait until the preconditions for network area deletion are met: `ReadyForNetworkAreaDeletionWaitHandler` + +## v0.29.2 +- Increase Timeouts for network area and network wait handlers to 30 minutes + +## v0.29.1 +- **Bugfix:** Parsing oneOf with enum and string value + +## v0.29.0 +- **Feature:** Add new method to get project details `GetProjectDetails` + +## v0.28.0 +- **Docs:** Improved descriptions of properties in structs with their possible values +- **Feature:** Add `Agent` field to `CreateImagePayload`, `UpdateImagePayload` and `Image` model +- **Feature:** Add `Encrypted` and `EncryptionsParameters` fields to `CreateVolumePayload` model + +## v0.27.1 +- **Dependencies:** Bump `github.com/golang-jwt/jwt/v5` from `v5.2.2` to `v5.2.3` + +## v0.27.0 +- **Feature:** Add `Dhcp` field in `CreateNetworkPayload`, `Network` and `PartialUpdateNetworkPayload` models + +## v0.26.0 +- **Feature:** Add `Metadata` field to `Server`, `CreateServerPayload`, and `UpdateServerPayload` models +- **Feature:** Increase maximum length validation for `machineType` and `volumePerformanceClass` from 63 to 127 characters + +## v0.25.0 +- Add `required:"true"` tags to model structs + +## v0.24.1 (2025-06-12) +- Update descriptions of model fields + +## v0.24.0 (2025-06-05) +- **Feature:** Add waiters for async operations: `CreateBackupWaitHandler`, `DeleteBackupWaitHandler`, `RestoreBackupWaitHandler` +- **Feature:** Add Waiters for async operations: `CreateSnapshotWaitHandler`, `DeleteSnapshotWaitHandler` + +## v0.23.0 (2025-05-15) +- **Breaking change:** Introduce interfaces for `APIClient` and the request structs + +## v0.22.2 (2025-05-09) +- **Feature:** Update user-agent header + +## v0.22.1 (2025-04-29) +- **Bugfix:** Correctly handle empty payload in body + +## v0.22.0 (2025-03-24) +- **Improvement:** Upgrading from IaaS **beta** endpoints to **v1** +- **Feature:** Add new method to filter `ListMachineTypes`: `Filter` + +## v0.21.2 (2025-03-19) +- **Internal:** Backwards compatible change to generated code + +## v0.21.1 (2025-03-02) + +- Increase Timeouts for volume and network wait handlers + +## v0.21.0 (2025-02-27) + +- **Feature:** Add method to list all public ip ranges: `ListPublicIpRanges` +- Add size attribute to image model +- Add CPU architecture attribute to image config model + +## v0.20.0 (2025-02-21) + +- **New:** Minimal go version is now Go 1.21 + +## v0.19.0 (2024-12-20) + +- **Feature:** Add method to list quotas: `ListQuotas` +- **Feature:** Add methods to change image scope: `UpdateImageScopeLocal` and `UpdateImageScopePublic` + +## v0.18.0 (2024-12-16) + +- **Feature:** Add waiters for async operations: `UploadImageWaitHandler` and `DeleteImageWaitHandler` + +## v0.17.0 (2024-12-16) + +- **Feature:** Add new methods to manage affinity groups: `CreateAffinityGroup`, `DeleteAffinityGroup`, `GetAffinityGroup`, and `ListAffinityGroup` +- **Feature:** Add new methods to manage backups: `CreateBackup`, `DeleteBackup`, `GetBackup`, `ListBackup`, `RestoreBackup`, `ExecuteBackup`,`UpdateBackup` +- **Feature:** Add new methods to manage images: `CreateImage`, `DeleteImage`, `GetImage`, `ListImage`,`UpdateImage` +- **Feature:** Add new methods to manage imageshares: `DeleteImageShare`, `GetImageShare`, `SetImageShare`,`UpdateImageShare` +- **Feature:** Add new methods to manage imageshare consumers: `DeleteImageShareConsumer`, `GetImageShareConsumer`, `SetImageShare`,`UpdateImageShare` +- **Feature:** Add new methods to manage project NICs: `GetProjectNIC`, `ListProjectNICs` +- **Feature:** Add new methods to manage snapshots: `CreateSnapshot`, `DeleteSnapshot`, `GetSnapshot`, `ListSnapshot`, `UpdateSnapshot` +- **Bugfix:** Correctly handle nullable attributes in model types + +## v0.16.0 (2024-11-08) + +- **Feature:** Add new methods to manage key pairs: `CreateKeyPair`, `UpdateKeyPair`, `DeleteKeyPair`, `GetKeyPair`, and `ListKeyPairs` +- **Feature:** Add new field `Bootable` to `Volume`, `CreateVolumePayload`, and `UpdateVolumePayload` data models +- **Breaking change:** Rename `NIC` to `Nic` in all network interface methods (e.g. `CreateNIC` to `CreateNic`, `AddNICToServer` to `AddNicToServer`, etc) + +## v0.15.0 (2024-10-21) + +- **Feature:** Filter network area routes by labels using the new `LabelSelector` method on `ApiListNetworkAreaRoutesRequest` +- **Feature:** Update network area route using the new method `UpdateNetworkAreaRoute` + +## v0.14.0 (2024-10-18) + +- **Feature:** Add waiter methods for `Volume`, `Server` and `AttachedVolume` + +## v0.13.0 (2024-10-18) + +- **Feature:** Add support for managing following resources + - `Volume` + - `Server` + - `NetworkInterface` + - `PublicIP` + - `SecurityGroup` + - `SecurityGroupRule` +- **Breaking change**: Remove `V1NetworkGateway` data model +- **Bugfix**: Network response json decoding + +## v0.12.0 (2024-10-14) + +- **Feature:** Add support for nullable models + +## v0.11.0 (2024-10-11) + +- **Feature:** Filter networks by labels using the new `LabelSelector` method on `ApiListNetworksRequest` + +## v0.10.0 (2024-10-01) + +- **Feature:** Add `CreatedAt` and `UpdatedAt` fields to several data models + +## v0.9.0 (2024-09-27) + +- **Feature:** Add `Labels` field to several data models + +## v0.8.0 (2024-08-21) + +- **Feature:** `CreateNetworkIPv4Body` and `CreateNetworkIPv6Body` have a new field `Prefix` + +## v0.7.0 (2024-08-16) + +- **Breaking change**: Rename types: + - `CreateNetworkIPv4` renamed to **`CreateNetworkIPv4Body`** + - `V1CreateNetworkIPv6` renamed to **`CreateNetworkIPv6Body`** + - `UpdateNetworkIPv4` renamed to **`UpdateNetworkIPv4Body`** + - `V1UpdateNetworkIPv6` renamed to **`UpdateNetworkIPv6Body`** +- **Feature:** `CreateNetworkPayload`, `PartialUpdateNetworkPayload` and `Network` have a new field: `Routed` + +## v0.6.0 (2024-08-05) + +- **Breaking change:** Use network ID instead of request ID in the waiter: `CreateNetworkWaitHandler` + +## v0.5.0 (2024-07-24) + +- **Feature:** `CreateNetworkAddressFamily` and `UpdateNetworkAddressFamily` have a new field `Ipv6` +- **Feature:** `Network` has new fields: `NameserversV6` and `PrefixesV6` + +## v0.4.0 (2024-06-07) + +- **Breaking change**: `CreateNetwork` now returns the `Network` triggered by the operation. + +## v0.3.0 (2024-05-17) + +- **Feature**: Add waiters for async operations: `CreateNetworkAreaWaitHandler`, `UpdateNetworkAreaWaitHandler`, `DeleteNetworkAreaWaitHandler`, `CreateNetworkWaitHandler`, `UpdateNetworkWaitHandler`, `DeleteNetworkWaitHandler` + +## v0.2.0 (2024-05-17) + +- **Feature**: New methods to manage networks: + - `CreateNetwork` + - `PartialUpdateNetwork` + - `DeleteNetwork` +- **Breaking change**: Rename methods for better correspondence with endpoint behaviour: + - `UpdateNetworkArea` renamed to **`PartialUpdateNetworkArea`** + - `CreateNetworkAreas` renamed to **`CreateNetworkArea`** + - `DeleteNetworkAreas` renamed to **`DeleteNetworkArea`** (same for the payload types) +- **Breaking change**: Rename types: + - Add `Response` suffix to types only used in method responses: + - `NetworkAreaList` renamed to **`NetworkAreaListResponse`** + - `NetworkList` renamed to **`NetworkListResponsse`** + - `NetworkRangeList` renamed to **`NetworkRangeListResponsse`** + - `ProjectList` renamed to **`ProjectListResponsse`** + - `RouteList` renamed to **`RouteListResponsse`** + - Remove `V1` prefix from all types: + - `V1NetworkArea` renamed to **`NetworkArea`** + - `V1AreaConfig` renamed to **`AreaConfig`** + - `V1Area` renamed to **`Area`** + - `V1CreateAreaAddressFamily` renamed to **`CreateAreaAddressFamily`** + - `V1CreateNetworkIPv4` renamed to **`CreateNetworkIPv4`** + - `V1Error` renamed to **`Error`** + - `V1NetworkAreaIPv4` renamed to **`NetworkAreaIPv4`** + - `V1RequestResource` renamed to **`RequestResource`** + - `V1UpdateAreaAddressFamily` renamed to **`UpdateAreaAddressFamily`** + - `V1UpdateAreaIPv4` renamed to **`UpdateAreaIPv4`** + - `V1UpdateNetworkIPv4` renamed to **`UpdateNetworkIPv4`** + +## v0.1.0 (2024-05-10) + +- **New BETA module**: Manage Infrastructure as a Service (IaaS) resources `Network` and `NetworkArea` diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/LICENSE.md b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/LICENSE.md new file mode 100644 index 00000000..7e2f0648 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/LICENSE.md @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright 2025 Schwarz IT KG + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/NOTICE.txt b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/NOTICE.txt new file mode 100644 index 00000000..ac4ed2cc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/NOTICE.txt @@ -0,0 +1,2 @@ +STACKIT IaaS SDK for Go +Copyright 2025 Schwarz IT KG diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/VERSION b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/VERSION new file mode 100644 index 00000000..0ec25f75 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/VERSION @@ -0,0 +1 @@ +v1.0.0 diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/api_default.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/api_default.go new file mode 100644 index 00000000..5787d74a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/api_default.go @@ -0,0 +1,30422 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultApi interface { + /* + AddNetworkToServer Create and attach a network interface from the specified network. + Create and attach a network interface from the specified network to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiAddNetworkToServerRequest + */ + AddNetworkToServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiAddNetworkToServerRequest + /* + AddNetworkToServerExecute executes the request + + */ + AddNetworkToServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error + /* + AddNicToServer Attach an existing network interface. + Attach an existing network interface to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiAddNicToServerRequest + */ + AddNicToServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiAddNicToServerRequest + /* + AddNicToServerExecute executes the request + + */ + AddNicToServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error + /* + AddPublicIpToServer Associate a public IP to the server. + Associate a public IP to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiAddPublicIpToServerRequest + */ + AddPublicIpToServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiAddPublicIpToServerRequest + /* + AddPublicIpToServerExecute executes the request + + */ + AddPublicIpToServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error + /* + AddRoutesToRoutingTable Create new routes in a routing table. + Create new routes in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiAddRoutesToRoutingTableRequest + */ + AddRoutesToRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiAddRoutesToRoutingTableRequest + /* + AddRoutesToRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RouteListResponse + + */ + AddRoutesToRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) + /* + AddRoutingTableToArea Create new routing table in a network area. + Create a new routing table in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiAddRoutingTableToAreaRequest + */ + AddRoutingTableToArea(ctx context.Context, organizationId string, areaId string, region string) ApiAddRoutingTableToAreaRequest + /* + AddRoutingTableToAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RoutingTable + + */ + AddRoutingTableToAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTable, error) + /* + AddSecurityGroupToServer Add a server to a security group. + Add an existing server to an existing security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiAddSecurityGroupToServerRequest + */ + AddSecurityGroupToServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiAddSecurityGroupToServerRequest + /* + AddSecurityGroupToServerExecute executes the request + + */ + AddSecurityGroupToServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error + /* + AddServiceAccountToServer Attach service account to a server. + Attach an additional service account to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiAddServiceAccountToServerRequest + */ + AddServiceAccountToServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiAddServiceAccountToServerRequest + /* + AddServiceAccountToServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ServiceAccountMailListResponse + + */ + AddServiceAccountToServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) + /* + AddVolumeToServer Attach a volume to a server. + Attach an existing volume to an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiAddVolumeToServerRequest + */ + AddVolumeToServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiAddVolumeToServerRequest + /* + AddVolumeToServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return VolumeAttachment + + */ + AddVolumeToServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) + /* + CreateAffinityGroup Create a new affinity group in a project. + Create a new server affinity group in the given project ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateAffinityGroupRequest + */ + CreateAffinityGroup(ctx context.Context, projectId string, region string) ApiCreateAffinityGroupRequest + /* + CreateAffinityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return AffinityGroup + + */ + CreateAffinityGroupExecute(ctx context.Context, projectId string, region string) (*AffinityGroup, error) + /* + CreateBackup Create new Backup. + Create a new Backup in a project. If a snapshot ID is provided create the backup from the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateBackupRequest + */ + CreateBackup(ctx context.Context, projectId string, region string) ApiCreateBackupRequest + /* + CreateBackupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Backup + + */ + CreateBackupExecute(ctx context.Context, projectId string, region string) (*Backup, error) + /* + CreateImage Create new Image. + Create a new Image in a project. This call, if successful, returns a pre-signed URL for the customer to upload the image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateImageRequest + */ + CreateImage(ctx context.Context, projectId string, region string) ApiCreateImageRequest + /* + CreateImageExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ImageCreateResponse + + */ + CreateImageExecute(ctx context.Context, projectId string, region string) (*ImageCreateResponse, error) + /* + CreateKeyPair Import a public key. + Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateKeyPairRequest + */ + CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest + /* + CreateKeyPairExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return Keypair + + */ + CreateKeyPairExecute(ctx context.Context) (*Keypair, error) + /* + CreateNetwork Create new network. + Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkRequest + */ + CreateNetwork(ctx context.Context, projectId string, region string) ApiCreateNetworkRequest + /* + CreateNetworkExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Network + + */ + CreateNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) + /* + CreateNetworkArea Create new network area in an organization. + Create a new network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiCreateNetworkAreaRequest + */ + CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest + /* + CreateNetworkAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return NetworkArea + + */ + CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) + /* + CreateNetworkAreaRange Create new network range in a network area. + Create a new network range in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRangeRequest + */ + CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRangeRequest + /* + CreateNetworkAreaRangeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return NetworkRangeListResponse + + */ + CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) + /* + CreateNetworkAreaRegion Configure a region for a network area. + Configure a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRegionRequest + */ + CreateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRegionRequest + /* + CreateNetworkAreaRegionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RegionalArea + + */ + CreateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) + /* + CreateNetworkAreaRoute Create new network routes. + Create one or several new network routes in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRouteRequest + */ + CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRouteRequest + /* + CreateNetworkAreaRouteExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RouteListResponse + + */ + CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) + /* + CreateNic Create new network interface. + Create a new network interface in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateNicRequest + */ + CreateNic(ctx context.Context, projectId string, region string, networkId string) ApiCreateNicRequest + /* + CreateNicExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return NIC + + */ + CreateNicExecute(ctx context.Context, projectId string, region string, networkId string) (*NIC, error) + /* + CreatePublicIP Create new public IP. + Create a new public IP in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreatePublicIPRequest + */ + CreatePublicIP(ctx context.Context, projectId string, region string) ApiCreatePublicIPRequest + /* + CreatePublicIPExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return PublicIp + + */ + CreatePublicIPExecute(ctx context.Context, projectId string, region string) (*PublicIp, error) + /* + CreateSecurityGroup Create new security group. + Create a new security group in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateSecurityGroupRequest + */ + CreateSecurityGroup(ctx context.Context, projectId string, region string) ApiCreateSecurityGroupRequest + /* + CreateSecurityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return SecurityGroup + + */ + CreateSecurityGroupExecute(ctx context.Context, projectId string, region string) (*SecurityGroup, error) + /* + CreateSecurityGroupRule Create new security group rule. + Create a new security group rule in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiCreateSecurityGroupRuleRequest + */ + CreateSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string) ApiCreateSecurityGroupRuleRequest + /* + CreateSecurityGroupRuleExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroupRule + + */ + CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRule, error) + /* + CreateServer Create new server. + Create a new server in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateServerRequest + */ + CreateServer(ctx context.Context, projectId string, region string) ApiCreateServerRequest + /* + CreateServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Server + + */ + CreateServerExecute(ctx context.Context, projectId string, region string) (*Server, error) + /* + CreateSnapshot Create new Snapshot. + Create a new Snapshot from a Volume in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateSnapshotRequest + */ + CreateSnapshot(ctx context.Context, projectId string, region string) ApiCreateSnapshotRequest + /* + CreateSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Snapshot + + */ + CreateSnapshotExecute(ctx context.Context, projectId string, region string) (*Snapshot, error) + /* + CreateVolume Create new volume. + Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateVolumeRequest + */ + CreateVolume(ctx context.Context, projectId string, region string) ApiCreateVolumeRequest + /* + CreateVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return Volume + + */ + CreateVolumeExecute(ctx context.Context, projectId string, region string) (*Volume, error) + /* + DeallocateServer Deallocate an existing server. + Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeallocateServerRequest + */ + DeallocateServer(ctx context.Context, projectId string, region string, serverId string) ApiDeallocateServerRequest + /* + DeallocateServerExecute executes the request + + */ + DeallocateServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + DeleteAffinityGroup Delete a affinity group in a project. + Delete a affinity group in the given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiDeleteAffinityGroupRequest + */ + DeleteAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiDeleteAffinityGroupRequest + /* + DeleteAffinityGroupExecute executes the request + + */ + DeleteAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) error + /* + DeleteBackup Delete a backup. + Delete a backup that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiDeleteBackupRequest + */ + DeleteBackup(ctx context.Context, projectId string, region string, backupId string) ApiDeleteBackupRequest + /* + DeleteBackupExecute executes the request + + */ + DeleteBackupExecute(ctx context.Context, projectId string, region string, backupId string) error + /* + DeleteImage Delete an Image. + Delete an image that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageRequest + */ + DeleteImage(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageRequest + /* + DeleteImageExecute executes the request + + */ + DeleteImageExecute(ctx context.Context, projectId string, region string, imageId string) error + /* + DeleteImageShare Remove image share. + Remove the image share. New scope will be local. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageShareRequest + */ + DeleteImageShare(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageShareRequest + /* + DeleteImageShareExecute executes the request + + */ + DeleteImageShareExecute(ctx context.Context, projectId string, region string, imageId string) error + /* + DeleteImageShareConsumer Remove an image share consumer. + Remove consumer from a shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiDeleteImageShareConsumerRequest + */ + DeleteImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiDeleteImageShareConsumerRequest + /* + DeleteImageShareConsumerExecute executes the request + + */ + DeleteImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) error + /* + DeleteKeyPair Delete an SSH keypair. + Delete an SSH keypair from a user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiDeleteKeyPairRequest + */ + DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest + /* + DeleteKeyPairExecute executes the request + + */ + DeleteKeyPairExecute(ctx context.Context, keypairName string) error + /* + DeleteNetwork Delete network. + Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest + */ + DeleteNetwork(ctx context.Context, projectId string, region string, networkId string) ApiDeleteNetworkRequest + /* + DeleteNetworkExecute executes the request + + */ + DeleteNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error + /* + DeleteNetworkArea Delete a network area. + Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiDeleteNetworkAreaRequest + */ + DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest + /* + DeleteNetworkAreaExecute executes the request + + */ + DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error + /* + DeleteNetworkAreaRange Delete a network range. + Delete a network range of a network area. The deletion will fail if the network range is still used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiDeleteNetworkAreaRangeRequest + */ + DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest + /* + DeleteNetworkAreaRangeExecute executes the request + + */ + DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) error + /* + DeleteNetworkAreaRegion Delete a configuration of region for a network area. + Delete a current configuration of region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiDeleteNetworkAreaRegionRequest + */ + DeleteNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiDeleteNetworkAreaRegionRequest + /* + DeleteNetworkAreaRegionExecute executes the request + + */ + DeleteNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) error + /* + DeleteNetworkAreaRoute Delete a network route. + Delete a network route of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteNetworkAreaRouteRequest + */ + DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiDeleteNetworkAreaRouteRequest + /* + DeleteNetworkAreaRouteExecute executes the request + + */ + DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) error + /* + DeleteNic Delete a network interface. + Delete a network interface that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNicRequest + */ + DeleteNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiDeleteNicRequest + /* + DeleteNicExecute executes the request + + */ + DeleteNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) error + /* + DeletePublicIP Delete a public IP. + Delete a public IP that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest + */ + DeletePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiDeletePublicIPRequest + /* + DeletePublicIPExecute executes the request + + */ + DeletePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) error + /* + DeleteRouteFromRoutingTable Delete a route in a routing table. + Delete a route in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteRouteFromRoutingTableRequest + */ + DeleteRouteFromRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiDeleteRouteFromRoutingTableRequest + /* + DeleteRouteFromRoutingTableExecute executes the request + + */ + DeleteRouteFromRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) error + /* + DeleteRoutingTableFromArea Delete a routing table. + Delete a routing table of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiDeleteRoutingTableFromAreaRequest + */ + DeleteRoutingTableFromArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiDeleteRoutingTableFromAreaRequest + /* + DeleteRoutingTableFromAreaExecute executes the request + + */ + DeleteRoutingTableFromAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) error + /* + DeleteSecurityGroup Delete security group. + Delete a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest + */ + DeleteSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiDeleteSecurityGroupRequest + /* + DeleteSecurityGroupExecute executes the request + + */ + DeleteSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) error + /* + DeleteSecurityGroupRule Delete security group rule. + Delete a security group rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiDeleteSecurityGroupRuleRequest + */ + DeleteSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest + /* + DeleteSecurityGroupRuleExecute executes the request + + */ + DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) error + /* + DeleteServer Delete a server. + Delete a server. Volumes won't be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest + */ + DeleteServer(ctx context.Context, projectId string, region string, serverId string) ApiDeleteServerRequest + /* + DeleteServerExecute executes the request + + */ + DeleteServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + DeleteSnapshot Delete a snapshot. + Delete a snapshot that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiDeleteSnapshotRequest + */ + DeleteSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiDeleteSnapshotRequest + /* + DeleteSnapshotExecute executes the request + + */ + DeleteSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) error + /* + DeleteVolume Delete a volume. + Delete a volume inside a project. The deletion will fail if the volume is still in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiDeleteVolumeRequest + */ + DeleteVolume(ctx context.Context, projectId string, region string, volumeId string) ApiDeleteVolumeRequest + /* + DeleteVolumeExecute executes the request + + */ + DeleteVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error + /* + GetAffinityGroup Get the affinity group. + Get the affinity group created in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiGetAffinityGroupRequest + */ + GetAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiGetAffinityGroupRequest + /* + GetAffinityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return AffinityGroup + + */ + GetAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) (*AffinityGroup, error) + /* + GetAttachedVolume Get Volume Attachment details. + Get the details of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetAttachedVolumeRequest + */ + GetAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiGetAttachedVolumeRequest + /* + GetAttachedVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return VolumeAttachment + + */ + GetAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) + /* + GetBackup Get details about a backup. + Get details about a block device backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiGetBackupRequest + */ + GetBackup(ctx context.Context, projectId string, region string, backupId string) ApiGetBackupRequest + /* + GetBackupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return Backup + + */ + GetBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) + /* + GetImage Get details about an image. + Get details about a specific Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageRequest + */ + GetImage(ctx context.Context, projectId string, region string, imageId string) ApiGetImageRequest + /* + GetImageExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return Image + + */ + GetImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) + /* + GetImageShare Get share details of an image. + Get share details about an shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageShareRequest + */ + GetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiGetImageShareRequest + /* + GetImageShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ImageShare + + */ + GetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) + /* + GetImageShareConsumer Get image share consumer. + Get details about an image share consumer. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiGetImageShareConsumerRequest + */ + GetImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiGetImageShareConsumerRequest + /* + GetImageShareConsumerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ImageShareConsumer + + */ + GetImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) (*ImageShareConsumer, error) + /* + GetKeyPair Get SSH keypair details. + Get details about an SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiGetKeyPairRequest + */ + GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest + /* + GetKeyPairExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return Keypair + + */ + GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) + /* + GetMachineType Get details about a machine type. + Get details about a specific machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param machineType STACKIT machine type Name. + @return ApiGetMachineTypeRequest + */ + GetMachineType(ctx context.Context, projectId string, region string, machineType string) ApiGetMachineTypeRequest + /* + GetMachineTypeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param machineType STACKIT machine type Name. + @return MachineType + + */ + GetMachineTypeExecute(ctx context.Context, projectId string, region string, machineType string) (*MachineType, error) + /* + GetNetwork Get network details. + Get details about a network of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest + */ + GetNetwork(ctx context.Context, projectId string, region string, networkId string) ApiGetNetworkRequest + /* + GetNetworkExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return Network + + */ + GetNetworkExecute(ctx context.Context, projectId string, region string, networkId string) (*Network, error) + /* + GetNetworkArea Get details about a network area. + Get details about a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiGetNetworkAreaRequest + */ + GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest + /* + GetNetworkAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return NetworkArea + + */ + GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) + /* + GetNetworkAreaRange Get details about a network range. + Get details about a network range in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiGetNetworkAreaRangeRequest + */ + GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiGetNetworkAreaRangeRequest + /* + GetNetworkAreaRangeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return NetworkRange + + */ + GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) (*NetworkRange, error) + /* + GetNetworkAreaRegion Get details about a configured region. + Get details about a configured region in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiGetNetworkAreaRegionRequest + */ + GetNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiGetNetworkAreaRegionRequest + /* + GetNetworkAreaRegionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RegionalArea + + */ + GetNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) + /* + GetNetworkAreaRoute Get details about a network route. + Get details about a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetNetworkAreaRouteRequest + */ + GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiGetNetworkAreaRouteRequest + /* + GetNetworkAreaRouteExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) + /* + GetNic Get details about a network interface. + Get details about a network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiGetNicRequest + */ + GetNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiGetNicRequest + /* + GetNicExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return NIC + + */ + GetNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) + /* + GetOrganizationRequest Lookup an organization request ID. + Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetOrganizationRequestRequest + */ + GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest + /* + GetOrganizationRequestExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return Request + + */ + GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) + /* + GetProjectDetails Get project details. + Get details about a STACKIT project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiGetProjectDetailsRequest + */ + GetProjectDetails(ctx context.Context, projectId string) ApiGetProjectDetailsRequest + /* + GetProjectDetailsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return Project + + */ + GetProjectDetailsExecute(ctx context.Context, projectId string) (*Project, error) + /* + GetProjectNIC Get details about a network interface of a project. + Get details about a network interface inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param nicId The identifier (ID) of a network interface. + @return ApiGetProjectNICRequest + */ + GetProjectNIC(ctx context.Context, projectId string, region string, nicId string) ApiGetProjectNICRequest + /* + GetProjectNICExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param nicId The identifier (ID) of a network interface. + @return NIC + + */ + GetProjectNICExecute(ctx context.Context, projectId string, region string, nicId string) (*NIC, error) + /* + GetProjectRequest Lookup a project request ID. + Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetProjectRequestRequest + */ + GetProjectRequest(ctx context.Context, projectId string, region string, requestId string) ApiGetProjectRequestRequest + /* + GetProjectRequestExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param requestId The identifier (ID) of a STACKIT Request. + @return Request + + */ + GetProjectRequestExecute(ctx context.Context, projectId string, region string, requestId string) (*Request, error) + /* + GetPublicIP Get details about a public IP. + Get details about a public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiGetPublicIPRequest + */ + GetPublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiGetPublicIPRequest + /* + GetPublicIPExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return PublicIp + + */ + GetPublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) + /* + GetRouteOfRoutingTable Get details about a route of a routing table. + Get details about a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetRouteOfRoutingTableRequest + */ + GetRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiGetRouteOfRoutingTableRequest + /* + GetRouteOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + GetRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) + /* + GetRoutingTableOfArea Get details about a routing table. + Get details about a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiGetRoutingTableOfAreaRequest + */ + GetRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiGetRoutingTableOfAreaRequest + /* + GetRoutingTableOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RoutingTable + + */ + GetRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) + /* + GetSecurityGroup Get security group details. + Get details about a security group of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiGetSecurityGroupRequest + */ + GetSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiGetSecurityGroupRequest + /* + GetSecurityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroup + + */ + GetSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) + /* + GetSecurityGroupRule Get security group rule details. + Get details about a security group rule of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiGetSecurityGroupRuleRequest + */ + GetSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest + /* + GetSecurityGroupRuleExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return SecurityGroupRule + + */ + GetSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) + /* + GetServer Get server details. + Get details about a server by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerRequest + */ + GetServer(ctx context.Context, projectId string, region string, serverId string) ApiGetServerRequest + /* + GetServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return Server + + */ + GetServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) + /* + GetServerConsole Get server console. + Get a URL for server remote console. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerConsoleRequest + */ + GetServerConsole(ctx context.Context, projectId string, region string, serverId string) ApiGetServerConsoleRequest + /* + GetServerConsoleExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ServerConsoleUrl + + */ + GetServerConsoleExecute(ctx context.Context, projectId string, region string, serverId string) (*ServerConsoleUrl, error) + /* + GetServerLog Get server log. + Get server console log. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerLogRequest + */ + GetServerLog(ctx context.Context, projectId string, region string, serverId string) ApiGetServerLogRequest + /* + GetServerLogExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return GetServerLog200Response + + */ + GetServerLogExecute(ctx context.Context, projectId string, region string, serverId string) (*GetServerLog200Response, error) + /* + GetSnapshot Get details about a snapshot. + Get details about a block device snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiGetSnapshotRequest + */ + GetSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiGetSnapshotRequest + /* + GetSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return Snapshot + + */ + GetSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) + /* + GetVolume Get details about a volume. + Get details about a block device volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetVolumeRequest + */ + GetVolume(ctx context.Context, projectId string, region string, volumeId string) ApiGetVolumeRequest + /* + GetVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return Volume + + */ + GetVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) + /* + GetVolumePerformanceClass Get details about a volume performance class. + Get details about a specific volume performance class. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return ApiGetVolumePerformanceClassRequest + */ + GetVolumePerformanceClass(ctx context.Context, projectId string, region string, volumePerformanceClass string) ApiGetVolumePerformanceClassRequest + /* + GetVolumePerformanceClassExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return VolumePerformanceClass + + */ + GetVolumePerformanceClassExecute(ctx context.Context, projectId string, region string, volumePerformanceClass string) (*VolumePerformanceClass, error) + /* + ListAffinityGroups Get the affinity groups setup for a project. + Get the affinity groups created in a project. Affinity groups are an indication of locality of a server relative to another group of servers. They can be either running on the same host (affinity) or on different ones (anti-affinity). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListAffinityGroupsRequest + */ + ListAffinityGroups(ctx context.Context, projectId string, region string) ApiListAffinityGroupsRequest + /* + ListAffinityGroupsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return AffinityGroupListResponse + + */ + ListAffinityGroupsExecute(ctx context.Context, projectId string, region string) (*AffinityGroupListResponse, error) + /* + ListAttachedVolumes List all volume attachments of a server. + Get a list of all volume attachments of a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListAttachedVolumesRequest + */ + ListAttachedVolumes(ctx context.Context, projectId string, region string, serverId string) ApiListAttachedVolumesRequest + /* + ListAttachedVolumesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return VolumeAttachmentListResponse + + */ + ListAttachedVolumesExecute(ctx context.Context, projectId string, region string, serverId string) (*VolumeAttachmentListResponse, error) + /* + ListAvailabilityZones List all availability zones. + Get a list of all availability zones. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region The STACKIT Region of the resources. + @return ApiListAvailabilityZonesRequest + */ + ListAvailabilityZones(ctx context.Context, region string) ApiListAvailabilityZonesRequest + /* + ListAvailabilityZonesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region The STACKIT Region of the resources. + @return AvailabilityZoneListResponse + + */ + ListAvailabilityZonesExecute(ctx context.Context, region string) (*AvailabilityZoneListResponse, error) + /* + ListBackups List all backups inside a project. + Get a list of all backups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListBackupsRequest + */ + ListBackups(ctx context.Context, projectId string, region string) ApiListBackupsRequest + /* + ListBackupsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return BackupListResponse + + */ + ListBackupsExecute(ctx context.Context, projectId string, region string) (*BackupListResponse, error) + /* + ListImages List all Images inside a project. + Get a list of all images inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListImagesRequest + */ + ListImages(ctx context.Context, projectId string, region string) ApiListImagesRequest + /* + ListImagesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ImageListResponse + + */ + ListImagesExecute(ctx context.Context, projectId string, region string) (*ImageListResponse, error) + /* + ListKeyPairs List all SSH keypairs for the requesting user. + Get a list of all SSH keypairs assigned to the requesting user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListKeyPairsRequest + */ + ListKeyPairs(ctx context.Context) ApiListKeyPairsRequest + /* + ListKeyPairsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return KeyPairListResponse + + */ + ListKeyPairsExecute(ctx context.Context) (*KeyPairListResponse, error) + /* + ListMachineTypes List all machine types available for a project. + Get a list of all machine type available in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListMachineTypesRequest + */ + ListMachineTypes(ctx context.Context, projectId string, region string) ApiListMachineTypesRequest + /* + ListMachineTypesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return MachineTypeListResponse + + */ + ListMachineTypesExecute(ctx context.Context, projectId string, region string) (*MachineTypeListResponse, error) + /* + ListNetworkAreaProjects List all projects using a network area. + Get a list of all projects using a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaProjectsRequest + */ + ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest + /* + ListNetworkAreaProjectsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ProjectListResponse + + */ + ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) + /* + ListNetworkAreaRanges List all network ranges in a network area. + Get a list of all network ranges in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRangesRequest + */ + ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRangesRequest + /* + ListNetworkAreaRangesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return NetworkRangeListResponse + + */ + ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) + /* + ListNetworkAreaRegions List all configured regions in a network area. + Get a list of all configured regions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaRegionsRequest + */ + ListNetworkAreaRegions(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRegionsRequest + /* + ListNetworkAreaRegionsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return RegionalAreaListResponse + + */ + ListNetworkAreaRegionsExecute(ctx context.Context, organizationId string, areaId string) (*RegionalAreaListResponse, error) + /* + ListNetworkAreaRoutes List all network routes in a network area. + Get a list of all network routes defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRoutesRequest + */ + ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRoutesRequest + /* + ListNetworkAreaRoutesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RouteListResponse + + */ + ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) + /* + ListNetworkAreas List all network areas in an organization. + Get a list of all visible network areas defined in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiListNetworkAreasRequest + */ + ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest + /* + ListNetworkAreasExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return NetworkAreaListResponse + + */ + ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) + /* + ListNetworks List all networks inside a project. + Get a list of all networks inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListNetworksRequest + */ + ListNetworks(ctx context.Context, projectId string, region string) ApiListNetworksRequest + /* + ListNetworksExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return NetworkListResponse + + */ + ListNetworksExecute(ctx context.Context, projectId string, region string) (*NetworkListResponse, error) + /* + ListNics List all network interfaces inside a network. + Get a list of all network interfaces inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListNicsRequest + */ + ListNics(ctx context.Context, projectId string, region string, networkId string) ApiListNicsRequest + /* + ListNicsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return NICListResponse + + */ + ListNicsExecute(ctx context.Context, projectId string, region string, networkId string) (*NICListResponse, error) + /* + ListProjectNICs List all network interfaces inside a project. + Get a list of all network interfaces inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListProjectNICsRequest + */ + ListProjectNICs(ctx context.Context, projectId string, region string) ApiListProjectNICsRequest + /* + ListProjectNICsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return NICListResponse + + */ + ListProjectNICsExecute(ctx context.Context, projectId string, region string) (*NICListResponse, error) + /* + ListPublicIPRanges List all public IP ranges. + Get a list of all public IP ranges that STACKIT uses. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPublicIPRangesRequest + */ + ListPublicIPRanges(ctx context.Context) ApiListPublicIPRangesRequest + /* + ListPublicIPRangesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return PublicNetworkListResponse + + */ + ListPublicIPRangesExecute(ctx context.Context) (*PublicNetworkListResponse, error) + /* + ListPublicIPs List all public IPs inside a project. + Get a list of all public IPs inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListPublicIPsRequest + */ + ListPublicIPs(ctx context.Context, projectId string, region string) ApiListPublicIPsRequest + /* + ListPublicIPsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return PublicIpListResponse + + */ + ListPublicIPsExecute(ctx context.Context, projectId string, region string) (*PublicIpListResponse, error) + /* + ListQuotas List project quotas. + List quota limits and usage for project resources. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListQuotasRequest + */ + ListQuotas(ctx context.Context, projectId string, region string) ApiListQuotasRequest + /* + ListQuotasExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return QuotaListResponse + + */ + ListQuotasExecute(ctx context.Context, projectId string, region string) (*QuotaListResponse, error) + /* + ListRoutesOfRoutingTable List all routes in a routing table. + Get a list of all routes in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListRoutesOfRoutingTableRequest + */ + ListRoutesOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListRoutesOfRoutingTableRequest + /* + ListRoutesOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RouteListResponse + + */ + ListRoutesOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) + /* + ListRoutingTablesOfArea List all routing tables in a network area. + Get a list of all routing tables in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListRoutingTablesOfAreaRequest + */ + ListRoutingTablesOfArea(ctx context.Context, organizationId string, areaId string, region string) ApiListRoutingTablesOfAreaRequest + /* + ListRoutingTablesOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RoutingTableListResponse + + */ + ListRoutingTablesOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTableListResponse, error) + /* + ListSecurityGroupRules List all rules for a security group. + Get a list of all rules inside a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiListSecurityGroupRulesRequest + */ + ListSecurityGroupRules(ctx context.Context, projectId string, region string, securityGroupId string) ApiListSecurityGroupRulesRequest + /* + ListSecurityGroupRulesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroupRuleListResponse + + */ + ListSecurityGroupRulesExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRuleListResponse, error) + /* + ListSecurityGroups List all security groups inside a project. + Get a list of all security groups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListSecurityGroupsRequest + */ + ListSecurityGroups(ctx context.Context, projectId string, region string) ApiListSecurityGroupsRequest + /* + ListSecurityGroupsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return SecurityGroupListResponse + + */ + ListSecurityGroupsExecute(ctx context.Context, projectId string, region string) (*SecurityGroupListResponse, error) + /* + ListServerNICs Get all network interfaces. + Get all network interfaces attached to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerNICsRequest + */ + ListServerNICs(ctx context.Context, projectId string, region string, serverId string) ApiListServerNICsRequest + /* + ListServerNICsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return NICListResponse + + */ + ListServerNICsExecute(ctx context.Context, projectId string, region string, serverId string) (*NICListResponse, error) + /* + ListServerServiceAccounts List all service accounts of the Server. + Get the list of the service accounts of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerServiceAccountsRequest + */ + ListServerServiceAccounts(ctx context.Context, projectId string, region string, serverId string) ApiListServerServiceAccountsRequest + /* + ListServerServiceAccountsExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ServiceAccountMailListResponse + + */ + ListServerServiceAccountsExecute(ctx context.Context, projectId string, region string, serverId string) (*ServiceAccountMailListResponse, error) + /* + ListServers List all servers inside a project. + Get a list of all servers inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListServersRequest + */ + ListServers(ctx context.Context, projectId string, region string) ApiListServersRequest + /* + ListServersExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ServerListResponse + + */ + ListServersExecute(ctx context.Context, projectId string, region string) (*ServerListResponse, error) + /* + ListSnapshotsInProject List all snapshots inside a project. + Get a list of all snapshots inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListSnapshotsInProjectRequest + */ + ListSnapshotsInProject(ctx context.Context, projectId string, region string) ApiListSnapshotsInProjectRequest + /* + ListSnapshotsInProjectExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return SnapshotListResponse + + */ + ListSnapshotsInProjectExecute(ctx context.Context, projectId string, region string) (*SnapshotListResponse, error) + /* + ListVolumePerformanceClasses List all volume performance classes available for a project. + Get a list of all volume performance classes available inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumePerformanceClassesRequest + */ + ListVolumePerformanceClasses(ctx context.Context, projectId string, region string) ApiListVolumePerformanceClassesRequest + /* + ListVolumePerformanceClassesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return VolumePerformanceClassListResponse + + */ + ListVolumePerformanceClassesExecute(ctx context.Context, projectId string, region string) (*VolumePerformanceClassListResponse, error) + /* + ListVolumes List all volumes inside a project. + Get a list of all volumes inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumesRequest + */ + ListVolumes(ctx context.Context, projectId string, region string) ApiListVolumesRequest + /* + ListVolumesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return VolumeListResponse + + */ + ListVolumesExecute(ctx context.Context, projectId string, region string) (*VolumeListResponse, error) + /* + PartialUpdateNetwork Update network settings. + Update the settings of a network inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest + */ + PartialUpdateNetwork(ctx context.Context, projectId string, region string, networkId string) ApiPartialUpdateNetworkRequest + /* + PartialUpdateNetworkExecute executes the request + + */ + PartialUpdateNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error + /* + PartialUpdateNetworkArea Update network area settings. + Update the settings of a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiPartialUpdateNetworkAreaRequest + */ + PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest + /* + PartialUpdateNetworkAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return NetworkArea + + */ + PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) + /* + RebootServer Reboot the server. + Reboot the server. A soft reboot will attempt to gracefully shut down the server by passing the command to the operating system. A hard reboot will power cycle the server without waiting for the operating system to shutdown properly. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRebootServerRequest + */ + RebootServer(ctx context.Context, projectId string, region string, serverId string) ApiRebootServerRequest + /* + RebootServerExecute executes the request + + */ + RebootServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + RemoveNetworkFromServer Detach and delete all network interfaces associated with the specified network. + Detach and delete all network interfaces associated with the specified network from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiRemoveNetworkFromServerRequest + */ + RemoveNetworkFromServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest + /* + RemoveNetworkFromServerExecute executes the request + + */ + RemoveNetworkFromServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error + /* + RemoveNicFromServer Detach a network interface. + Detach a network interface from a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiRemoveNicFromServerRequest + */ + RemoveNicFromServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiRemoveNicFromServerRequest + /* + RemoveNicFromServerExecute executes the request + + */ + RemoveNicFromServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error + /* + RemovePublicIpFromServer Dissociate a public IP from a server. + Dissociate a public IP on an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiRemovePublicIpFromServerRequest + */ + RemovePublicIpFromServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiRemovePublicIpFromServerRequest + /* + RemovePublicIpFromServerExecute executes the request + + */ + RemovePublicIpFromServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error + /* + RemoveSecurityGroupFromServer Remove a server from a security group. + Remove a server from a attached security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiRemoveSecurityGroupFromServerRequest + */ + RemoveSecurityGroupFromServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiRemoveSecurityGroupFromServerRequest + /* + RemoveSecurityGroupFromServerExecute executes the request + + */ + RemoveSecurityGroupFromServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error + /* + RemoveServiceAccountFromServer Detach a service account from a server. + Detach an additional service account from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiRemoveServiceAccountFromServerRequest + */ + RemoveServiceAccountFromServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiRemoveServiceAccountFromServerRequest + /* + RemoveServiceAccountFromServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ServiceAccountMailListResponse + + */ + RemoveServiceAccountFromServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) + /* + RemoveVolumeFromServer Detach a volume from a server. + Detach an existing volume from an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiRemoveVolumeFromServerRequest + */ + RemoveVolumeFromServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiRemoveVolumeFromServerRequest + /* + RemoveVolumeFromServerExecute executes the request + + */ + RemoveVolumeFromServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) error + /* + RescueServer Rescue an existing server. + Rescue an existing server. It is shutdown and the initial image is attached as the boot volume, while the boot volume is attached as secondary volume and the server is booted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRescueServerRequest + */ + RescueServer(ctx context.Context, projectId string, region string, serverId string) ApiRescueServerRequest + /* + RescueServerExecute executes the request + + */ + RescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + ResizeServer Resize a server. + Resize the server to the given machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiResizeServerRequest + */ + ResizeServer(ctx context.Context, projectId string, region string, serverId string) ApiResizeServerRequest + /* + ResizeServerExecute executes the request + + */ + ResizeServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + ResizeVolume Update the size of a volume. + Update the size of a block device volume. The new volume size must be larger than the current size. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiResizeVolumeRequest + */ + ResizeVolume(ctx context.Context, projectId string, region string, volumeId string) ApiResizeVolumeRequest + /* + ResizeVolumeExecute executes the request + + */ + ResizeVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error + /* + RestoreBackup Restore Backup to the referenced source Volume. + Restores a Backup to the existing Volume it references to. The use of this endpoint is disruptive as the volume needs to be detached. If a new volume is to be created use the volumes endpoint with the option to create from backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiRestoreBackupRequest + */ + RestoreBackup(ctx context.Context, projectId string, region string, backupId string) ApiRestoreBackupRequest + /* + RestoreBackupExecute executes the request + + */ + RestoreBackupExecute(ctx context.Context, projectId string, region string, backupId string) error + /* + SetImageShare Set image share. + Set share of an Image. New Options will replace existing settings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiSetImageShareRequest + */ + SetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiSetImageShareRequest + /* + SetImageShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ImageShare + + */ + SetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) + /* + StartServer Boot up a server. + Start an existing server or allocates the server if deallocated. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStartServerRequest + */ + StartServer(ctx context.Context, projectId string, region string, serverId string) ApiStartServerRequest + /* + StartServerExecute executes the request + + */ + StartServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + StopServer Stop an existing server. + Stops an existing server. The server will remain on the Hypervisor and will be charged full price for all resources attached to it. The attached resources will remain reserved. Useful particularly for vGPU servers. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStopServerRequest + */ + StopServer(ctx context.Context, projectId string, region string, serverId string) ApiStopServerRequest + /* + StopServerExecute executes the request + + */ + StopServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + UnrescueServer Unrescue an existing server. + Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUnrescueServerRequest + */ + UnrescueServer(ctx context.Context, projectId string, region string, serverId string) ApiUnrescueServerRequest + /* + UnrescueServerExecute executes the request + + */ + UnrescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error + /* + UpdateAttachedVolume Update Volume Attachment Parameters. + Update the properties of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateAttachedVolumeRequest + */ + UpdateAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest + /* + UpdateAttachedVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return VolumeAttachment + + */ + UpdateAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) + /* + UpdateBackup Update information of a backup. + Update name or labels of the backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiUpdateBackupRequest + */ + UpdateBackup(ctx context.Context, projectId string, region string, backupId string) ApiUpdateBackupRequest + /* + UpdateBackupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return Backup + + */ + UpdateBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) + /* + UpdateImage Update Image Parameters. + Update the properties of an existing Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageRequest + */ + UpdateImage(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageRequest + /* + UpdateImageExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return Image + + */ + UpdateImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) + /* + UpdateImageShare Update image share. + Update share of an Image. Projects will be appended to existing list. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageShareRequest + */ + UpdateImageShare(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageShareRequest + /* + UpdateImageShareExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ImageShare + + */ + UpdateImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) + /* + UpdateKeyPair Update information of an SSH keypair. + Update labels of the SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiUpdateKeyPairRequest + */ + UpdateKeyPair(ctx context.Context, keypairName string) ApiUpdateKeyPairRequest + /* + UpdateKeyPairExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return Keypair + + */ + UpdateKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) + /* + UpdateNetworkAreaRegion Update a region for a network area. + Update a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiUpdateNetworkAreaRegionRequest + */ + UpdateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiUpdateNetworkAreaRegionRequest + /* + UpdateNetworkAreaRegionExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return RegionalArea + + */ + UpdateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) + /* + UpdateNetworkAreaRoute Update a network route. + Update a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateNetworkAreaRouteRequest + */ + UpdateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiUpdateNetworkAreaRouteRequest + /* + UpdateNetworkAreaRouteExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + UpdateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) + /* + UpdateNic Update a network interface. + Update the properties of an existing network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiUpdateNicRequest + */ + UpdateNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiUpdateNicRequest + /* + UpdateNicExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return NIC + + */ + UpdateNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) + /* + UpdatePublicIP Update a public IP. + Update the properties of an existing public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiUpdatePublicIPRequest + */ + UpdatePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiUpdatePublicIPRequest + /* + UpdatePublicIPExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return PublicIp + + */ + UpdatePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) + /* + UpdateRouteOfRoutingTable Update a route of a routing table. + Update a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateRouteOfRoutingTableRequest + */ + UpdateRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiUpdateRouteOfRoutingTableRequest + /* + UpdateRouteOfRoutingTableExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return Route + + */ + UpdateRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) + /* + UpdateRoutingTableOfArea Update a routing table. + Update a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiUpdateRoutingTableOfAreaRequest + */ + UpdateRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiUpdateRoutingTableOfAreaRequest + /* + UpdateRoutingTableOfAreaExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return RoutingTable + + */ + UpdateRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) + /* + UpdateSecurityGroup Update information of a security group. + Update labels of the security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiUpdateSecurityGroupRequest + */ + UpdateSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiUpdateSecurityGroupRequest + /* + UpdateSecurityGroupExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return SecurityGroup + + */ + UpdateSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) + /* + UpdateServer Update information of a server. + Update name or labels of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUpdateServerRequest + */ + UpdateServer(ctx context.Context, projectId string, region string, serverId string) ApiUpdateServerRequest + /* + UpdateServerExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return Server + + */ + UpdateServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) + /* + UpdateSnapshot Update information of the snapshot. + Update information like name or labels of the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiUpdateSnapshotRequest + */ + UpdateSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiUpdateSnapshotRequest + /* + UpdateSnapshotExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return Snapshot + + */ + UpdateSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) + /* + UpdateVolume Update information of a volume. + Update name, description or labels of the volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateVolumeRequest + */ + UpdateVolume(ctx context.Context, projectId string, region string, volumeId string) ApiUpdateVolumeRequest + /* + UpdateVolumeExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return Volume + + */ + UpdateVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) +} + +type ApiAddNetworkToServerRequest interface { + Execute() error +} + +type ApiAddNicToServerRequest interface { + Execute() error +} + +type ApiAddPublicIpToServerRequest interface { + Execute() error +} + +type ApiAddRoutesToRoutingTableRequest interface { + // Request an addition of routes to a routing table. + AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload) ApiAddRoutesToRoutingTableRequest + Execute() (*RouteListResponse, error) +} + +type ApiAddRoutingTableToAreaRequest interface { + // Request an addition of a routing table to an area. + AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload AddRoutingTableToAreaPayload) ApiAddRoutingTableToAreaRequest + Execute() (*RoutingTable, error) +} + +type ApiAddSecurityGroupToServerRequest interface { + Execute() error +} + +type ApiAddServiceAccountToServerRequest interface { + Execute() (*ServiceAccountMailListResponse, error) +} + +type ApiAddVolumeToServerRequest interface { + // Request a volume attachment creation. + AddVolumeToServerPayload(addVolumeToServerPayload AddVolumeToServerPayload) ApiAddVolumeToServerRequest + Execute() (*VolumeAttachment, error) +} + +type ApiCreateAffinityGroupRequest interface { + // Request a affinity group creation. + CreateAffinityGroupPayload(createAffinityGroupPayload CreateAffinityGroupPayload) ApiCreateAffinityGroupRequest + Execute() (*AffinityGroup, error) +} + +type ApiCreateBackupRequest interface { + // Request a backup creation. + CreateBackupPayload(createBackupPayload CreateBackupPayload) ApiCreateBackupRequest + Execute() (*Backup, error) +} + +type ApiCreateImageRequest interface { + // Request an image creation. + CreateImagePayload(createImagePayload CreateImagePayload) ApiCreateImageRequest + Execute() (*ImageCreateResponse, error) +} + +type ApiCreateKeyPairRequest interface { + // Request a public key import. + CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest + Execute() (*Keypair, error) +} + +type ApiCreateNetworkRequest interface { + // Request a network creation. + CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest + Execute() (*Network, error) +} + +type ApiCreateNetworkAreaRequest interface { + // Request an Area creation. + CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest + Execute() (*NetworkArea, error) +} + +type ApiCreateNetworkAreaRangeRequest interface { + // Request an addition of network ranges to an area. + CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest + Execute() (*NetworkRangeListResponse, error) +} + +type ApiCreateNetworkAreaRegionRequest interface { + // Request to add a new regional network area configuration. + CreateNetworkAreaRegionPayload(createNetworkAreaRegionPayload CreateNetworkAreaRegionPayload) ApiCreateNetworkAreaRegionRequest + Execute() (*RegionalArea, error) +} + +type ApiCreateNetworkAreaRouteRequest interface { + // Request an addition of routes to an area. + CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest + Execute() (*RouteListResponse, error) +} + +type ApiCreateNicRequest interface { + // Request a network interface creation. + CreateNicPayload(createNicPayload CreateNicPayload) ApiCreateNicRequest + Execute() (*NIC, error) +} + +type ApiCreatePublicIPRequest interface { + // Request a public IP creation. + CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest + Execute() (*PublicIp, error) +} + +type ApiCreateSecurityGroupRequest interface { + // Request a security group creation. + CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest + Execute() (*SecurityGroup, error) +} + +type ApiCreateSecurityGroupRuleRequest interface { + // Request for a security group rule creation. + CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest + Execute() (*SecurityGroupRule, error) +} + +type ApiCreateServerRequest interface { + // Request a server creation. + CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest + Execute() (*Server, error) +} + +type ApiCreateSnapshotRequest interface { + // Request a snapshot creation. + CreateSnapshotPayload(createSnapshotPayload CreateSnapshotPayload) ApiCreateSnapshotRequest + Execute() (*Snapshot, error) +} + +type ApiCreateVolumeRequest interface { + // Request a volume creation. + CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest + Execute() (*Volume, error) +} + +type ApiDeallocateServerRequest interface { + Execute() error +} + +type ApiDeleteAffinityGroupRequest interface { + Execute() error +} + +type ApiDeleteBackupRequest interface { + // Force action. + Force(force bool) ApiDeleteBackupRequest + Execute() error +} + +type ApiDeleteImageRequest interface { + Execute() error +} + +type ApiDeleteImageShareRequest interface { + Execute() error +} + +type ApiDeleteImageShareConsumerRequest interface { + Execute() error +} + +type ApiDeleteKeyPairRequest interface { + Execute() error +} + +type ApiDeleteNetworkRequest interface { + Execute() error +} + +type ApiDeleteNetworkAreaRequest interface { + Execute() error +} + +type ApiDeleteNetworkAreaRangeRequest interface { + Execute() error +} + +type ApiDeleteNetworkAreaRegionRequest interface { + Execute() error +} + +type ApiDeleteNetworkAreaRouteRequest interface { + Execute() error +} + +type ApiDeleteNicRequest interface { + Execute() error +} + +type ApiDeletePublicIPRequest interface { + Execute() error +} + +type ApiDeleteRouteFromRoutingTableRequest interface { + Execute() error +} + +type ApiDeleteRoutingTableFromAreaRequest interface { + Execute() error +} + +type ApiDeleteSecurityGroupRequest interface { + Execute() error +} + +type ApiDeleteSecurityGroupRuleRequest interface { + Execute() error +} + +type ApiDeleteServerRequest interface { + Execute() error +} + +type ApiDeleteSnapshotRequest interface { + Execute() error +} + +type ApiDeleteVolumeRequest interface { + Execute() error +} + +type ApiGetAffinityGroupRequest interface { + Execute() (*AffinityGroup, error) +} + +type ApiGetAttachedVolumeRequest interface { + Execute() (*VolumeAttachment, error) +} + +type ApiGetBackupRequest interface { + Execute() (*Backup, error) +} + +type ApiGetImageRequest interface { + Execute() (*Image, error) +} + +type ApiGetImageShareRequest interface { + Execute() (*ImageShare, error) +} + +type ApiGetImageShareConsumerRequest interface { + Execute() (*ImageShareConsumer, error) +} + +type ApiGetKeyPairRequest interface { + Execute() (*Keypair, error) +} + +type ApiGetMachineTypeRequest interface { + Execute() (*MachineType, error) +} + +type ApiGetNetworkRequest interface { + Execute() (*Network, error) +} + +type ApiGetNetworkAreaRequest interface { + Execute() (*NetworkArea, error) +} + +type ApiGetNetworkAreaRangeRequest interface { + Execute() (*NetworkRange, error) +} + +type ApiGetNetworkAreaRegionRequest interface { + Execute() (*RegionalArea, error) +} + +type ApiGetNetworkAreaRouteRequest interface { + Execute() (*Route, error) +} + +type ApiGetNicRequest interface { + Execute() (*NIC, error) +} + +type ApiGetOrganizationRequestRequest interface { + Execute() (*Request, error) +} + +type ApiGetProjectDetailsRequest interface { + Execute() (*Project, error) +} + +type ApiGetProjectNICRequest interface { + Execute() (*NIC, error) +} + +type ApiGetProjectRequestRequest interface { + Execute() (*Request, error) +} + +type ApiGetPublicIPRequest interface { + Execute() (*PublicIp, error) +} + +type ApiGetRouteOfRoutingTableRequest interface { + Execute() (*Route, error) +} + +type ApiGetRoutingTableOfAreaRequest interface { + Execute() (*RoutingTable, error) +} + +type ApiGetSecurityGroupRequest interface { + Execute() (*SecurityGroup, error) +} + +type ApiGetSecurityGroupRuleRequest interface { + Execute() (*SecurityGroupRule, error) +} + +type ApiGetServerRequest interface { + // Show detailed information about server. + Details(details bool) ApiGetServerRequest + Execute() (*Server, error) +} + +type ApiGetServerConsoleRequest interface { + Execute() (*ServerConsoleUrl, error) +} + +type ApiGetServerLogRequest interface { + // Request the server log. By default the length is limited to 2000 lines. Set to 0 to retrieve the complete log. + Length(length int64) ApiGetServerLogRequest + Execute() (*GetServerLog200Response, error) +} + +type ApiGetSnapshotRequest interface { + Execute() (*Snapshot, error) +} + +type ApiGetVolumeRequest interface { + Execute() (*Volume, error) +} + +type ApiGetVolumePerformanceClassRequest interface { + Execute() (*VolumePerformanceClass, error) +} + +type ApiListAffinityGroupsRequest interface { + Execute() (*AffinityGroupListResponse, error) +} + +type ApiListAttachedVolumesRequest interface { + Execute() (*VolumeAttachmentListResponse, error) +} + +type ApiListAvailabilityZonesRequest interface { + Execute() (*AvailabilityZoneListResponse, error) +} + +type ApiListBackupsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListBackupsRequest + Execute() (*BackupListResponse, error) +} + +type ApiListImagesRequest interface { + // List all Images. + All(all bool) ApiListImagesRequest + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListImagesRequest + Execute() (*ImageListResponse, error) +} + +type ApiListKeyPairsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListKeyPairsRequest + Execute() (*KeyPairListResponse, error) +} + +type ApiListMachineTypesRequest interface { + // Filter resources by fields. A subset of expr-lang is supported. See https://expr-lang.org/docs/language-definition for usage details. + Filter(filter string) ApiListMachineTypesRequest + Execute() (*MachineTypeListResponse, error) +} + +type ApiListNetworkAreaProjectsRequest interface { + Execute() (*ProjectListResponse, error) +} + +type ApiListNetworkAreaRangesRequest interface { + Execute() (*NetworkRangeListResponse, error) +} + +type ApiListNetworkAreaRegionsRequest interface { + Execute() (*RegionalAreaListResponse, error) +} + +type ApiListNetworkAreaRoutesRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNetworkAreaRoutesRequest + Execute() (*RouteListResponse, error) +} + +type ApiListNetworkAreasRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNetworkAreasRequest + Execute() (*NetworkAreaListResponse, error) +} + +type ApiListNetworksRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNetworksRequest + Execute() (*NetworkListResponse, error) +} + +type ApiListNicsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListNicsRequest + Execute() (*NICListResponse, error) +} + +type ApiListProjectNICsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListProjectNICsRequest + Execute() (*NICListResponse, error) +} + +type ApiListPublicIPRangesRequest interface { + Execute() (*PublicNetworkListResponse, error) +} + +type ApiListPublicIPsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListPublicIPsRequest + Execute() (*PublicIpListResponse, error) +} + +type ApiListQuotasRequest interface { + Execute() (*QuotaListResponse, error) +} + +type ApiListRoutesOfRoutingTableRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListRoutesOfRoutingTableRequest + Execute() (*RouteListResponse, error) +} + +type ApiListRoutingTablesOfAreaRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListRoutingTablesOfAreaRequest + Execute() (*RoutingTableListResponse, error) +} + +type ApiListSecurityGroupRulesRequest interface { + Execute() (*SecurityGroupRuleListResponse, error) +} + +type ApiListSecurityGroupsRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListSecurityGroupsRequest + Execute() (*SecurityGroupListResponse, error) +} + +type ApiListServerNICsRequest interface { + Execute() (*NICListResponse, error) +} + +type ApiListServerServiceAccountsRequest interface { + Execute() (*ServiceAccountMailListResponse, error) +} + +type ApiListServersRequest interface { + // Show detailed information about server. + Details(details bool) ApiListServersRequest + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListServersRequest + Execute() (*ServerListResponse, error) +} + +type ApiListSnapshotsInProjectRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListSnapshotsInProjectRequest + Execute() (*SnapshotListResponse, error) +} + +type ApiListVolumePerformanceClassesRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListVolumePerformanceClassesRequest + Execute() (*VolumePerformanceClassListResponse, error) +} + +type ApiListVolumesRequest interface { + // Filter resources by labels. + LabelSelector(labelSelector string) ApiListVolumesRequest + Execute() (*VolumeListResponse, error) +} + +type ApiPartialUpdateNetworkRequest interface { + // Request an update of a network. + PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest + Execute() error +} + +type ApiPartialUpdateNetworkAreaRequest interface { + // Request to update an Area. + PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest + Execute() (*NetworkArea, error) +} + +type ApiRebootServerRequest interface { + // Defines if it is a soft or a hard reboot. + Action(action string) ApiRebootServerRequest + Execute() error +} + +type ApiRemoveNetworkFromServerRequest interface { + Execute() error +} + +type ApiRemoveNicFromServerRequest interface { + Execute() error +} + +type ApiRemovePublicIpFromServerRequest interface { + Execute() error +} + +type ApiRemoveSecurityGroupFromServerRequest interface { + Execute() error +} + +type ApiRemoveServiceAccountFromServerRequest interface { + Execute() (*ServiceAccountMailListResponse, error) +} + +type ApiRemoveVolumeFromServerRequest interface { + Execute() error +} + +type ApiRescueServerRequest interface { + // Request a server rescue. + RescueServerPayload(rescueServerPayload RescueServerPayload) ApiRescueServerRequest + Execute() error +} + +type ApiResizeServerRequest interface { + // Request a resize of a server. + ResizeServerPayload(resizeServerPayload ResizeServerPayload) ApiResizeServerRequest + Execute() error +} + +type ApiResizeVolumeRequest interface { + // Request a volume resize. + ResizeVolumePayload(resizeVolumePayload ResizeVolumePayload) ApiResizeVolumeRequest + Execute() error +} + +type ApiRestoreBackupRequest interface { + Execute() error +} + +type ApiSetImageShareRequest interface { + // Settings for an Image Share. + SetImageSharePayload(setImageSharePayload SetImageSharePayload) ApiSetImageShareRequest + Execute() (*ImageShare, error) +} + +type ApiStartServerRequest interface { + Execute() error +} + +type ApiStopServerRequest interface { + Execute() error +} + +type ApiUnrescueServerRequest interface { + Execute() error +} + +type ApiUpdateAttachedVolumeRequest interface { + // Request a volume attachment update. + UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest + Execute() (*VolumeAttachment, error) +} + +type ApiUpdateBackupRequest interface { + // Request an update of a backup. + UpdateBackupPayload(updateBackupPayload UpdateBackupPayload) ApiUpdateBackupRequest + Execute() (*Backup, error) +} + +type ApiUpdateImageRequest interface { + // Request an update of an Image. + UpdateImagePayload(updateImagePayload UpdateImagePayload) ApiUpdateImageRequest + Execute() (*Image, error) +} + +type ApiUpdateImageShareRequest interface { + // Update an Image Share. + UpdateImageSharePayload(updateImageSharePayload UpdateImageSharePayload) ApiUpdateImageShareRequest + Execute() (*ImageShare, error) +} + +type ApiUpdateKeyPairRequest interface { + // Request an update of an SSH keypair. + UpdateKeyPairPayload(updateKeyPairPayload UpdateKeyPairPayload) ApiUpdateKeyPairRequest + Execute() (*Keypair, error) +} + +type ApiUpdateNetworkAreaRegionRequest interface { + // Request an update of a regional network area. + UpdateNetworkAreaRegionPayload(updateNetworkAreaRegionPayload UpdateNetworkAreaRegionPayload) ApiUpdateNetworkAreaRegionRequest + Execute() (*RegionalArea, error) +} + +type ApiUpdateNetworkAreaRouteRequest interface { + // Request an update of a network route. + UpdateNetworkAreaRoutePayload(updateNetworkAreaRoutePayload UpdateNetworkAreaRoutePayload) ApiUpdateNetworkAreaRouteRequest + Execute() (*Route, error) +} + +type ApiUpdateNicRequest interface { + // Request an update of a network interface. + UpdateNicPayload(updateNicPayload UpdateNicPayload) ApiUpdateNicRequest + Execute() (*NIC, error) +} + +type ApiUpdatePublicIPRequest interface { + // Request an update of a public IP. + UpdatePublicIPPayload(updatePublicIPPayload UpdatePublicIPPayload) ApiUpdatePublicIPRequest + Execute() (*PublicIp, error) +} + +type ApiUpdateRouteOfRoutingTableRequest interface { + // Request an update of a route in a routing table. + UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload UpdateRouteOfRoutingTablePayload) ApiUpdateRouteOfRoutingTableRequest + Execute() (*Route, error) +} + +type ApiUpdateRoutingTableOfAreaRequest interface { + // Request an update of a routing table. + UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload UpdateRoutingTableOfAreaPayload) ApiUpdateRoutingTableOfAreaRequest + Execute() (*RoutingTable, error) +} + +type ApiUpdateSecurityGroupRequest interface { + // Request an update of a security group. + UpdateSecurityGroupPayload(updateSecurityGroupPayload UpdateSecurityGroupPayload) ApiUpdateSecurityGroupRequest + Execute() (*SecurityGroup, error) +} + +type ApiUpdateServerRequest interface { + // Request an update of a server. + UpdateServerPayload(updateServerPayload UpdateServerPayload) ApiUpdateServerRequest + Execute() (*Server, error) +} + +type ApiUpdateSnapshotRequest interface { + // Request an update of a snapshot. + UpdateSnapshotPayload(updateSnapshotPayload UpdateSnapshotPayload) ApiUpdateSnapshotRequest + Execute() (*Snapshot, error) +} + +type ApiUpdateVolumeRequest interface { + // Request an update of a volume. + UpdateVolumePayload(updateVolumePayload UpdateVolumePayload) ApiUpdateVolumeRequest + Execute() (*Volume, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type AddNetworkToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + networkId string +} + +func (r AddNetworkToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNetworkToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddNetworkToServer: Create and attach a network interface from the specified network. + +Create and attach a network interface from the specified network to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiAddNetworkToServerRequest +*/ +func (a *APIClient) AddNetworkToServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiAddNetworkToServerRequest { + return AddNetworkToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } +} + +func (a *APIClient) AddNetworkToServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error { + r := AddNetworkToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } + return r.Execute() +} + +type AddNicToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + nicId string +} + +func (r AddNicToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddNicToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddNicToServer: Attach an existing network interface. + +Attach an existing network interface to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiAddNicToServerRequest +*/ +func (a *APIClient) AddNicToServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiAddNicToServerRequest { + return AddNicToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } +} + +func (a *APIClient) AddNicToServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error { + r := AddNicToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } + return r.Execute() +} + +type AddPublicIpToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + publicIpId string +} + +func (r AddPublicIpToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddPublicIpToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddPublicIpToServer: Associate a public IP to the server. + +Associate a public IP to a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiAddPublicIpToServerRequest +*/ +func (a *APIClient) AddPublicIpToServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiAddPublicIpToServerRequest { + return AddPublicIpToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) AddPublicIpToServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error { + r := AddPublicIpToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type AddRoutesToRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + addRoutesToRoutingTablePayload *AddRoutesToRoutingTablePayload +} + +// Request an addition of routes to a routing table. + +func (r AddRoutesToRoutingTableRequest) AddRoutesToRoutingTablePayload(addRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload) ApiAddRoutesToRoutingTableRequest { + r.addRoutesToRoutingTablePayload = &addRoutesToRoutingTablePayload + return r +} + +func (r AddRoutesToRoutingTableRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddRoutesToRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if r.addRoutesToRoutingTablePayload == nil { + return localVarReturnValue, fmt.Errorf("addRoutesToRoutingTablePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addRoutesToRoutingTablePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddRoutesToRoutingTable: Create new routes in a routing table. + +Create new routes in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiAddRoutesToRoutingTableRequest +*/ +func (a *APIClient) AddRoutesToRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiAddRoutesToRoutingTableRequest { + return AddRoutesToRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) AddRoutesToRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) { + r := AddRoutesToRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type AddRoutingTableToAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + addRoutingTableToAreaPayload *AddRoutingTableToAreaPayload +} + +// Request an addition of a routing table to an area. + +func (r AddRoutingTableToAreaRequest) AddRoutingTableToAreaPayload(addRoutingTableToAreaPayload AddRoutingTableToAreaPayload) ApiAddRoutingTableToAreaRequest { + r.addRoutingTableToAreaPayload = &addRoutingTableToAreaPayload + return r +} + +func (r AddRoutingTableToAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddRoutingTableToArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.addRoutingTableToAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("addRoutingTableToAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addRoutingTableToAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddRoutingTableToArea: Create new routing table in a network area. + +Create a new routing table in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiAddRoutingTableToAreaRequest +*/ +func (a *APIClient) AddRoutingTableToArea(ctx context.Context, organizationId string, areaId string, region string) ApiAddRoutingTableToAreaRequest { + return AddRoutingTableToAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) AddRoutingTableToAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTable, error) { + r := AddRoutingTableToAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type AddSecurityGroupToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + securityGroupId string +} + +func (r AddSecurityGroupToServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddSecurityGroupToServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +AddSecurityGroupToServer: Add a server to a security group. + +Add an existing server to an existing security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiAddSecurityGroupToServerRequest +*/ +func (a *APIClient) AddSecurityGroupToServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiAddSecurityGroupToServerRequest { + return AddSecurityGroupToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) AddSecurityGroupToServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error { + r := AddSecurityGroupToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type AddServiceAccountToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + serviceAccountMail string +} + +func (r AddServiceAccountToServerRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddServiceAccountToServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddServiceAccountToServer: Attach service account to a server. + +Attach an additional service account to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiAddServiceAccountToServerRequest +*/ +func (a *APIClient) AddServiceAccountToServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiAddServiceAccountToServerRequest { + return AddServiceAccountToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } +} + +func (a *APIClient) AddServiceAccountToServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { + r := AddServiceAccountToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } + return r.Execute() +} + +type AddVolumeToServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string + addVolumeToServerPayload *AddVolumeToServerPayload +} + +// Request a volume attachment creation. + +func (r AddVolumeToServerRequest) AddVolumeToServerPayload(addVolumeToServerPayload AddVolumeToServerPayload) ApiAddVolumeToServerRequest { + r.addVolumeToServerPayload = &addVolumeToServerPayload + return r +} + +func (r AddVolumeToServerRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.AddVolumeToServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.addVolumeToServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +AddVolumeToServer: Attach a volume to a server. + +Attach an existing volume to an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiAddVolumeToServerRequest +*/ +func (a *APIClient) AddVolumeToServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiAddVolumeToServerRequest { + return AddVolumeToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) AddVolumeToServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := AddVolumeToServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type CreateAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createAffinityGroupPayload *CreateAffinityGroupPayload +} + +// Request a affinity group creation. + +func (r CreateAffinityGroupRequest) CreateAffinityGroupPayload(createAffinityGroupPayload CreateAffinityGroupPayload) ApiCreateAffinityGroupRequest { + r.createAffinityGroupPayload = &createAffinityGroupPayload + return r +} + +func (r CreateAffinityGroupRequest) Execute() (*AffinityGroup, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AffinityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAffinityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/affinity-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createAffinityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createAffinityGroupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAffinityGroupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateAffinityGroup: Create a new affinity group in a project. + +Create a new server affinity group in the given project ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateAffinityGroupRequest +*/ +func (a *APIClient) CreateAffinityGroup(ctx context.Context, projectId string, region string) ApiCreateAffinityGroupRequest { + return CreateAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateAffinityGroupExecute(ctx context.Context, projectId string, region string) (*AffinityGroup, error) { + r := CreateAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createBackupPayload *CreateBackupPayload +} + +// Request a backup creation. + +func (r CreateBackupRequest) CreateBackupPayload(createBackupPayload CreateBackupPayload) ApiCreateBackupRequest { + r.createBackupPayload = &createBackupPayload + return r +} + +func (r CreateBackupRequest) Execute() (*Backup, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateBackup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/backups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createBackupPayload == nil { + return localVarReturnValue, fmt.Errorf("createBackupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createBackupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateBackup: Create new Backup. + +Create a new Backup in a project. If a snapshot ID is provided create the backup from the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateBackupRequest +*/ +func (a *APIClient) CreateBackup(ctx context.Context, projectId string, region string) ApiCreateBackupRequest { + return CreateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateBackupExecute(ctx context.Context, projectId string, region string) (*Backup, error) { + r := CreateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createImagePayload *CreateImagePayload +} + +// Request an image creation. + +func (r CreateImageRequest) CreateImagePayload(createImagePayload CreateImagePayload) ApiCreateImageRequest { + r.createImagePayload = &createImagePayload + return r +} + +func (r CreateImageRequest) Execute() (*ImageCreateResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageCreateResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createImagePayload == nil { + return localVarReturnValue, fmt.Errorf("createImagePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createImagePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateImage: Create new Image. + +Create a new Image in a project. This call, if successful, returns a pre-signed URL for the customer to upload the image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateImageRequest +*/ +func (a *APIClient) CreateImage(ctx context.Context, projectId string, region string) ApiCreateImageRequest { + return CreateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateImageExecute(ctx context.Context, projectId string, region string) (*ImageCreateResponse, error) { + r := CreateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + createKeyPairPayload *CreateKeyPairPayload +} + +// Request a public key import. + +func (r CreateKeyPairRequest) CreateKeyPairPayload(createKeyPairPayload CreateKeyPairPayload) ApiCreateKeyPairRequest { + r.createKeyPairPayload = &createKeyPairPayload + return r +} + +func (r CreateKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/keypairs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createKeyPairPayload == nil { + return localVarReturnValue, fmt.Errorf("createKeyPairPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createKeyPairPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateKeyPair: Import a public key. + +Import a new public key for the requesting user based on provided public key material. The creation will fail if an SSH keypair with the same name already exists. If a name is not provided it is autogenerated form the ssh-pubkey comment section. If that is also not present it will be the the MD5 fingerprint of the key. For autogenerated names invalid characters will be removed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiCreateKeyPairRequest +*/ +func (a *APIClient) CreateKeyPair(ctx context.Context) ApiCreateKeyPairRequest { + return CreateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) CreateKeyPairExecute(ctx context.Context) (*Keypair, error) { + r := CreateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type CreateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createNetworkPayload *CreateNetworkPayload +} + +// Request a network creation. + +func (r CreateNetworkRequest) CreateNetworkPayload(createNetworkPayload CreateNetworkPayload) ApiCreateNetworkRequest { + r.createNetworkPayload = &createNetworkPayload + return r +} + +func (r CreateNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createNetworkPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetwork: Create new network. + +Create a new network in a project. `nameservers` will be filled from `defaultNameservers` of the respective area if not specified. If the project has `internetAccess` enabled and this is the first network in the project this might incur cost. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkRequest +*/ +func (a *APIClient) CreateNetwork(ctx context.Context, projectId string, region string) ApiCreateNetworkRequest { + return CreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) { + r := CreateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + createNetworkAreaPayload *CreateNetworkAreaPayload +} + +// Request an Area creation. + +func (r CreateNetworkAreaRequest) CreateNetworkAreaPayload(createNetworkAreaPayload CreateNetworkAreaPayload) ApiCreateNetworkAreaRequest { + r.createNetworkAreaPayload = &createNetworkAreaPayload + return r +} + +func (r CreateNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if r.createNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetworkArea: Create new network area in an organization. + +Create a new network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiCreateNetworkAreaRequest +*/ +func (a *APIClient) CreateNetworkArea(ctx context.Context, organizationId string) ApiCreateNetworkAreaRequest { + return CreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } +} + +func (a *APIClient) CreateNetworkAreaExecute(ctx context.Context, organizationId string) (*NetworkArea, error) { + r := CreateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } + return r.Execute() +} + +type CreateNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + createNetworkAreaRangePayload *CreateNetworkAreaRangePayload +} + +// Request an addition of network ranges to an area. + +func (r CreateNetworkAreaRangeRequest) CreateNetworkAreaRangePayload(createNetworkAreaRangePayload CreateNetworkAreaRangePayload) ApiCreateNetworkAreaRangeRequest { + r.createNetworkAreaRangePayload = &createNetworkAreaRangePayload + return r +} + +func (r CreateNetworkAreaRangeRequest) Execute() (*NetworkRangeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRangeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRange") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.createNetworkAreaRangePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRangePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkAreaRangePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetworkAreaRange: Create new network range in a network area. + +Create a new network range in an existing network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRangeRequest +*/ +func (a *APIClient) CreateNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRangeRequest { + return CreateNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) CreateNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) { + r := CreateNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type CreateNetworkAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + createNetworkAreaRegionPayload *CreateNetworkAreaRegionPayload +} + +// Request to add a new regional network area configuration. + +func (r CreateNetworkAreaRegionRequest) CreateNetworkAreaRegionPayload(createNetworkAreaRegionPayload CreateNetworkAreaRegionPayload) ApiCreateNetworkAreaRegionRequest { + r.createNetworkAreaRegionPayload = &createNetworkAreaRegionPayload + return r +} + +func (r CreateNetworkAreaRegionRequest) Execute() (*RegionalArea, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRegion") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.createNetworkAreaRegionPayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRegionPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkAreaRegionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetworkAreaRegion: Configure a region for a network area. + +Configure a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRegionRequest +*/ +func (a *APIClient) CreateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRegionRequest { + return CreateNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) CreateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) { + r := CreateNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type CreateNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + createNetworkAreaRoutePayload *CreateNetworkAreaRoutePayload +} + +// Request an addition of routes to an area. + +func (r CreateNetworkAreaRouteRequest) CreateNetworkAreaRoutePayload(createNetworkAreaRoutePayload CreateNetworkAreaRoutePayload) ApiCreateNetworkAreaRouteRequest { + r.createNetworkAreaRoutePayload = &createNetworkAreaRoutePayload + return r +} + +func (r CreateNetworkAreaRouteRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNetworkAreaRoute") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.createNetworkAreaRoutePayload == nil { + return localVarReturnValue, fmt.Errorf("createNetworkAreaRoutePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNetworkAreaRoutePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNetworkAreaRoute: Create new network routes. + +Create one or several new network routes in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiCreateNetworkAreaRouteRequest +*/ +func (a *APIClient) CreateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string) ApiCreateNetworkAreaRouteRequest { + return CreateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) CreateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) { + r := CreateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type CreateNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + createNicPayload *CreateNicPayload +} + +// Request a network interface creation. + +func (r CreateNicRequest) CreateNicPayload(createNicPayload CreateNicPayload) ApiCreateNicRequest { + r.createNicPayload = &createNicPayload + return r +} + +func (r CreateNicRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateNic") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if r.createNicPayload == nil { + return localVarReturnValue, fmt.Errorf("createNicPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createNicPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateNic: Create new network interface. + +Create a new network interface in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiCreateNicRequest +*/ +func (a *APIClient) CreateNic(ctx context.Context, projectId string, region string, networkId string) ApiCreateNicRequest { + return CreateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) CreateNicExecute(ctx context.Context, projectId string, region string, networkId string) (*NIC, error) { + r := CreateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type CreatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createPublicIPPayload *CreatePublicIPPayload +} + +// Request a public IP creation. + +func (r CreatePublicIPRequest) CreatePublicIPPayload(createPublicIPPayload CreatePublicIPPayload) ApiCreatePublicIPRequest { + r.createPublicIPPayload = &createPublicIPPayload + return r +} + +func (r CreatePublicIPRequest) Execute() (*PublicIp, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreatePublicIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/public-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createPublicIPPayload == nil { + return localVarReturnValue, fmt.Errorf("createPublicIPPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createPublicIPPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreatePublicIP: Create new public IP. + +Create a new public IP in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreatePublicIPRequest +*/ +func (a *APIClient) CreatePublicIP(ctx context.Context, projectId string, region string) ApiCreatePublicIPRequest { + return CreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreatePublicIPExecute(ctx context.Context, projectId string, region string) (*PublicIp, error) { + r := CreatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createSecurityGroupPayload *CreateSecurityGroupPayload +} + +// Request a security group creation. + +func (r CreateSecurityGroupRequest) CreateSecurityGroupPayload(createSecurityGroupPayload CreateSecurityGroupPayload) ApiCreateSecurityGroupRequest { + r.createSecurityGroupPayload = &createSecurityGroupPayload + return r +} + +func (r CreateSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSecurityGroupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateSecurityGroup: Create new security group. + +Create a new security group in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateSecurityGroupRequest +*/ +func (a *APIClient) CreateSecurityGroup(ctx context.Context, projectId string, region string) ApiCreateSecurityGroupRequest { + return CreateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateSecurityGroupExecute(ctx context.Context, projectId string, region string) (*SecurityGroup, error) { + r := CreateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + createSecurityGroupRulePayload *CreateSecurityGroupRulePayload +} + +// Request for a security group rule creation. + +func (r CreateSecurityGroupRuleRequest) CreateSecurityGroupRulePayload(createSecurityGroupRulePayload CreateSecurityGroupRulePayload) ApiCreateSecurityGroupRuleRequest { + r.createSecurityGroupRulePayload = &createSecurityGroupRulePayload + return r +} + +func (r CreateSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRule + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSecurityGroupRule") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if r.createSecurityGroupRulePayload == nil { + return localVarReturnValue, fmt.Errorf("createSecurityGroupRulePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSecurityGroupRulePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateSecurityGroupRule: Create new security group rule. + +Create a new security group rule in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiCreateSecurityGroupRuleRequest +*/ +func (a *APIClient) CreateSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string) ApiCreateSecurityGroupRuleRequest { + return CreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) CreateSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRule, error) { + r := CreateSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type CreateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createServerPayload *CreateServerPayload +} + +// Request a server creation. + +func (r CreateServerRequest) CreateServerPayload(createServerPayload CreateServerPayload) ApiCreateServerRequest { + r.createServerPayload = &createServerPayload + return r +} + +func (r CreateServerRequest) Execute() (*Server, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createServerPayload == nil { + return localVarReturnValue, fmt.Errorf("createServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateServer: Create new server. + +Create a new server in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateServerRequest +*/ +func (a *APIClient) CreateServer(ctx context.Context, projectId string, region string) ApiCreateServerRequest { + return CreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateServerExecute(ctx context.Context, projectId string, region string) (*Server, error) { + r := CreateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createSnapshotPayload *CreateSnapshotPayload +} + +// Request a snapshot creation. + +func (r CreateSnapshotRequest) CreateSnapshotPayload(createSnapshotPayload CreateSnapshotPayload) ApiCreateSnapshotRequest { + r.createSnapshotPayload = &createSnapshotPayload + return r +} + +func (r CreateSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createSnapshotPayload == nil { + return localVarReturnValue, fmt.Errorf("createSnapshotPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createSnapshotPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateSnapshot: Create new Snapshot. + +Create a new Snapshot from a Volume in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateSnapshotRequest +*/ +func (a *APIClient) CreateSnapshot(ctx context.Context, projectId string, region string) ApiCreateSnapshotRequest { + return CreateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateSnapshotExecute(ctx context.Context, projectId string, region string) (*Snapshot, error) { + r := CreateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type CreateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + createVolumePayload *CreateVolumePayload +} + +// Request a volume creation. + +func (r CreateVolumeRequest) CreateVolumePayload(createVolumePayload CreateVolumePayload) ApiCreateVolumeRequest { + r.createVolumePayload = &createVolumePayload + return r +} + +func (r CreateVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if r.createVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("createVolumePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateVolume: Create new volume. + +Create a new volume in a project. If a volume source is not provided, an empty volume will be created. The size property is required if no source or an image source is provided. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiCreateVolumeRequest +*/ +func (a *APIClient) CreateVolume(ctx context.Context, projectId string, region string) ApiCreateVolumeRequest { + return CreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) CreateVolumeExecute(ctx context.Context, projectId string, region string) (*Volume, error) { + r := CreateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type DeallocateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r DeallocateServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeallocateServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/deallocate" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeallocateServer: Deallocate an existing server. + +Deallocate an existing server. The server will be removed from the hypervisor so only the volume will be billed. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeallocateServerRequest +*/ +func (a *APIClient) DeallocateServer(ctx context.Context, projectId string, region string, serverId string) ApiDeallocateServerRequest { + return DeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) DeallocateServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := DeallocateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type DeleteAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + affinityGroupId string +} + +func (r DeleteAffinityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAffinityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(r.affinityGroupId, "affinityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.affinityGroupId) < 36 { + return fmt.Errorf("affinityGroupId must have at least 36 elements") + } + if strlen(r.affinityGroupId) > 36 { + return fmt.Errorf("affinityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteAffinityGroup: Delete a affinity group in a project. + +Delete a affinity group in the given project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiDeleteAffinityGroupRequest +*/ +func (a *APIClient) DeleteAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiDeleteAffinityGroupRequest { + return DeleteAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } +} + +func (a *APIClient) DeleteAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) error { + r := DeleteAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } + return r.Execute() +} + +type DeleteBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string + force *bool +} + +// Force action. + +func (r DeleteBackupRequest) Force(force bool) ApiDeleteBackupRequest { + r.force = &force + return r +} + +func (r DeleteBackupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteBackup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return fmt.Errorf("backupId must have less than 36 elements") + } + + if r.force != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "force", r.force, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteBackup: Delete a backup. + +Delete a backup that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiDeleteBackupRequest +*/ +func (a *APIClient) DeleteBackup(ctx context.Context, projectId string, region string, backupId string) ApiDeleteBackupRequest { + return DeleteBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) DeleteBackupExecute(ctx context.Context, projectId string, region string, backupId string) error { + r := DeleteBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type DeleteImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r DeleteImageRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImage") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteImage: Delete an Image. + +Delete an image that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageRequest +*/ +func (a *APIClient) DeleteImage(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageRequest { + return DeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) DeleteImageExecute(ctx context.Context, projectId string, region string, imageId string) error { + r := DeleteImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type DeleteImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r DeleteImageShareRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShare") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteImageShare: Remove image share. + +Remove the image share. New scope will be local. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiDeleteImageShareRequest +*/ +func (a *APIClient) DeleteImageShare(ctx context.Context, projectId string, region string, imageId string) ApiDeleteImageShareRequest { + return DeleteImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) DeleteImageShareExecute(ctx context.Context, projectId string, region string, imageId string) error { + r := DeleteImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type DeleteImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + consumerProjectId string +} + +func (r DeleteImageShareConsumerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteImageShareConsumer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(r.consumerProjectId, "consumerProjectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return fmt.Errorf("imageId must have less than 36 elements") + } + if strlen(r.consumerProjectId) < 36 { + return fmt.Errorf("consumerProjectId must have at least 36 elements") + } + if strlen(r.consumerProjectId) > 36 { + return fmt.Errorf("consumerProjectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteImageShareConsumer: Remove an image share consumer. + +Remove consumer from a shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiDeleteImageShareConsumerRequest +*/ +func (a *APIClient) DeleteImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiDeleteImageShareConsumerRequest { + return DeleteImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } +} + +func (a *APIClient) DeleteImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) error { + r := DeleteImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } + return r.Execute() +} + +type DeleteKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string +} + +func (r DeleteKeyPairRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteKeyPair") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return fmt.Errorf("keypairName must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteKeyPair: Delete an SSH keypair. + +Delete an SSH keypair from a user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiDeleteKeyPairRequest +*/ +func (a *APIClient) DeleteKeyPair(ctx context.Context, keypairName string) ApiDeleteKeyPairRequest { + return DeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) DeleteKeyPairExecute(ctx context.Context, keypairName string) error { + r := DeleteKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type DeleteNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string +} + +func (r DeleteNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetwork: Delete network. + +Delete a network. If the network is still in use, the deletion will fail. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiDeleteNetworkRequest +*/ +func (a *APIClient) DeleteNetwork(ctx context.Context, projectId string, region string, networkId string) ApiDeleteNetworkRequest { + return DeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) DeleteNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error { + r := DeleteNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type DeleteNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r DeleteNetworkAreaRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkArea") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkArea: Delete a network area. + +Delete an existing network area in an organization. This is only possible if no projects are using the area anymore. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiDeleteNetworkAreaRequest +*/ +func (a *APIClient) DeleteNetworkArea(ctx context.Context, organizationId string, areaId string) ApiDeleteNetworkAreaRequest { + return DeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) DeleteNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) error { + r := DeleteNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type DeleteNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + networkRangeId string +} + +func (r DeleteNetworkAreaRangeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRange") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.networkRangeId) < 36 { + return fmt.Errorf("networkRangeId must have at least 36 elements") + } + if strlen(r.networkRangeId) > 36 { + return fmt.Errorf("networkRangeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkAreaRange: Delete a network range. + +Delete a network range of a network area. The deletion will fail if the network range is still used. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiDeleteNetworkAreaRangeRequest +*/ +func (a *APIClient) DeleteNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiDeleteNetworkAreaRangeRequest { + return DeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) error { + r := DeleteNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } + return r.Execute() +} + +type DeleteNetworkAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string +} + +func (r DeleteNetworkAreaRegionRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRegion") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkAreaRegion: Delete a configuration of region for a network area. + +Delete a current configuration of region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiDeleteNetworkAreaRegionRequest +*/ +func (a *APIClient) DeleteNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiDeleteNetworkAreaRegionRequest { + return DeleteNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) DeleteNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) error { + r := DeleteNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type DeleteNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routeId string +} + +func (r DeleteNetworkAreaRouteRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNetworkAreaRoute") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNetworkAreaRoute: Delete a network route. + +Delete a network route of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteNetworkAreaRouteRequest +*/ +func (a *APIClient) DeleteNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiDeleteNetworkAreaRouteRequest { + return DeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } +} + +func (a *APIClient) DeleteNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) error { + r := DeleteNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } + return r.Execute() +} + +type DeleteNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + nicId string +} + +func (r DeleteNicRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteNic") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteNic: Delete a network interface. + +Delete a network interface that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiDeleteNicRequest +*/ +func (a *APIClient) DeleteNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiDeleteNicRequest { + return DeleteNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) DeleteNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) error { + r := DeleteNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type DeletePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + publicIpId string +} + +func (r DeletePublicIPRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeletePublicIP") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeletePublicIP: Delete a public IP. + +Delete a public IP that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiDeletePublicIPRequest +*/ +func (a *APIClient) DeletePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiDeletePublicIPRequest { + return DeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } +} + +func (a *APIClient) DeletePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) error { + r := DeletePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } + return r.Execute() +} + +type DeleteRouteFromRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string +} + +func (r DeleteRouteFromRoutingTableRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRouteFromRoutingTable") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteRouteFromRoutingTable: Delete a route in a routing table. + +Delete a route in an existing routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiDeleteRouteFromRoutingTableRequest +*/ +func (a *APIClient) DeleteRouteFromRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiDeleteRouteFromRoutingTableRequest { + return DeleteRouteFromRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) DeleteRouteFromRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) error { + r := DeleteRouteFromRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type DeleteRoutingTableFromAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string +} + +func (r DeleteRoutingTableFromAreaRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteRoutingTableFromArea") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return fmt.Errorf("routingTableId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteRoutingTableFromArea: Delete a routing table. + +Delete a routing table of a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiDeleteRoutingTableFromAreaRequest +*/ +func (a *APIClient) DeleteRoutingTableFromArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiDeleteRoutingTableFromAreaRequest { + return DeleteRoutingTableFromAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) DeleteRoutingTableFromAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) error { + r := DeleteRoutingTableFromAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type DeleteSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string +} + +func (r DeleteSecurityGroupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroup: Delete security group. + +Delete a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiDeleteSecurityGroupRequest +*/ +func (a *APIClient) DeleteSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiDeleteSecurityGroupRequest { + return DeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) DeleteSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) error { + r := DeleteSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type DeleteSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + securityGroupRuleId string +} + +func (r DeleteSecurityGroupRuleRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSecurityGroupRule") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSecurityGroupRule: Delete security group rule. + +Delete a security group rule. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiDeleteSecurityGroupRuleRequest +*/ +func (a *APIClient) DeleteSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiDeleteSecurityGroupRuleRequest { + return DeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } +} + +func (a *APIClient) DeleteSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) error { + r := DeleteSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } + return r.Execute() +} + +type DeleteServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r DeleteServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteServer: Delete a server. + +Delete a server. Volumes won't be deleted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiDeleteServerRequest +*/ +func (a *APIClient) DeleteServer(ctx context.Context, projectId string, region string, serverId string) ApiDeleteServerRequest { + return DeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) DeleteServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := DeleteServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type DeleteSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + snapshotId string +} + +func (r DeleteSnapshotRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteSnapshot") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return fmt.Errorf("snapshotId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteSnapshot: Delete a snapshot. + +Delete a snapshot that is part of the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiDeleteSnapshotRequest +*/ +func (a *APIClient) DeleteSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiDeleteSnapshotRequest { + return DeleteSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } +} + +func (a *APIClient) DeleteSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) error { + r := DeleteSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } + return r.Execute() +} + +type DeleteVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string +} + +func (r DeleteVolumeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteVolume") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +DeleteVolume: Delete a volume. + +Delete a volume inside a project. The deletion will fail if the volume is still in use. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiDeleteVolumeRequest +*/ +func (a *APIClient) DeleteVolume(ctx context.Context, projectId string, region string, volumeId string) ApiDeleteVolumeRequest { + return DeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) DeleteVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error { + r := DeleteVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} + +type GetAffinityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + affinityGroupId string +} + +func (r GetAffinityGroupRequest) Execute() (*AffinityGroup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AffinityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAffinityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/affinity-groups/{affinityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"affinityGroupId"+"}", url.PathEscape(ParameterValueToString(r.affinityGroupId, "affinityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.affinityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("affinityGroupId must have at least 36 elements") + } + if strlen(r.affinityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("affinityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAffinityGroup: Get the affinity group. + +Get the affinity group created in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param affinityGroupId The identifier (ID) of a STACKIT Affinity Group. + @return ApiGetAffinityGroupRequest +*/ +func (a *APIClient) GetAffinityGroup(ctx context.Context, projectId string, region string, affinityGroupId string) ApiGetAffinityGroupRequest { + return GetAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } +} + +func (a *APIClient) GetAffinityGroupExecute(ctx context.Context, projectId string, region string, affinityGroupId string) (*AffinityGroup, error) { + r := GetAffinityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + affinityGroupId: affinityGroupId, + } + return r.Execute() +} + +type GetAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string +} + +func (r GetAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAttachedVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetAttachedVolume: Get Volume Attachment details. + +Get the details of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetAttachedVolumeRequest +*/ +func (a *APIClient) GetAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiGetAttachedVolumeRequest { + return GetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) GetAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := GetAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type GetBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string +} + +func (r GetBackupRequest) Execute() (*Backup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetBackup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return localVarReturnValue, fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return localVarReturnValue, fmt.Errorf("backupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetBackup: Get details about a backup. + +Get details about a block device backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiGetBackupRequest +*/ +func (a *APIClient) GetBackup(ctx context.Context, projectId string, region string, backupId string) ApiGetBackupRequest { + return GetBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) GetBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) { + r := GetBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type GetImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r GetImageRequest) Execute() (*Image, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Image + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImage: Get details about an image. + +Get details about a specific Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageRequest +*/ +func (a *APIClient) GetImage(ctx context.Context, projectId string, region string, imageId string) ApiGetImageRequest { + return GetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) GetImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) { + r := GetImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type GetImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string +} + +func (r GetImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImageShare: Get share details of an image. + +Get share details about an shared image. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiGetImageShareRequest +*/ +func (a *APIClient) GetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiGetImageShareRequest { + return GetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) GetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) { + r := GetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type GetImageShareConsumerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + consumerProjectId string +} + +func (r GetImageShareConsumerRequest) Execute() (*ImageShareConsumer, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShareConsumer + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetImageShareConsumer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}/share/{consumerProjectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"consumerProjectId"+"}", url.PathEscape(ParameterValueToString(r.consumerProjectId, "consumerProjectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if strlen(r.consumerProjectId) < 36 { + return localVarReturnValue, fmt.Errorf("consumerProjectId must have at least 36 elements") + } + if strlen(r.consumerProjectId) > 36 { + return localVarReturnValue, fmt.Errorf("consumerProjectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetImageShareConsumer: Get image share consumer. + +Get details about an image share consumer. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @param consumerProjectId The identifier (ID) of a STACKIT Project that consumes an image share. + @return ApiGetImageShareConsumerRequest +*/ +func (a *APIClient) GetImageShareConsumer(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) ApiGetImageShareConsumerRequest { + return GetImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } +} + +func (a *APIClient) GetImageShareConsumerExecute(ctx context.Context, projectId string, region string, imageId string, consumerProjectId string) (*ImageShareConsumer, error) { + r := GetImageShareConsumerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + consumerProjectId: consumerProjectId, + } + return r.Execute() +} + +type GetKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string +} + +func (r GetKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetKeyPair: Get SSH keypair details. + +Get details about an SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiGetKeyPairRequest +*/ +func (a *APIClient) GetKeyPair(ctx context.Context, keypairName string) ApiGetKeyPairRequest { + return GetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) GetKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { + r := GetKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type GetMachineTypeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + machineType string +} + +func (r GetMachineTypeRequest) Execute() (*MachineType, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MachineType + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetMachineType") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/machine-types/{machineType}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"machineType"+"}", url.PathEscape(ParameterValueToString(r.machineType, "machineType")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.machineType) > 127 { + return localVarReturnValue, fmt.Errorf("machineType must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetMachineType: Get details about a machine type. + +Get details about a specific machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param machineType STACKIT machine type Name. + @return ApiGetMachineTypeRequest +*/ +func (a *APIClient) GetMachineType(ctx context.Context, projectId string, region string, machineType string) ApiGetMachineTypeRequest { + return GetMachineTypeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + machineType: machineType, + } +} + +func (a *APIClient) GetMachineTypeExecute(ctx context.Context, projectId string, region string, machineType string) (*MachineType, error) { + r := GetMachineTypeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + machineType: machineType, + } + return r.Execute() +} + +type GetNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string +} + +func (r GetNetworkRequest) Execute() (*Network, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Network + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetwork") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetwork: Get network details. + +Get details about a network of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiGetNetworkRequest +*/ +func (a *APIClient) GetNetwork(ctx context.Context, projectId string, region string, networkId string) ApiGetNetworkRequest { + return GetNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) GetNetworkExecute(ctx context.Context, projectId string, region string, networkId string) (*Network, error) { + r := GetNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type GetNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r GetNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetworkArea: Get details about a network area. + +Get details about a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiGetNetworkAreaRequest +*/ +func (a *APIClient) GetNetworkArea(ctx context.Context, organizationId string, areaId string) ApiGetNetworkAreaRequest { + return GetNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) GetNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := GetNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type GetNetworkAreaRangeRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + networkRangeId string +} + +func (r GetNetworkAreaRangeRequest) Execute() (*NetworkRange, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRange + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRange") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges/{networkRangeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkRangeId"+"}", url.PathEscape(ParameterValueToString(r.networkRangeId, "networkRangeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.networkRangeId) < 36 { + return localVarReturnValue, fmt.Errorf("networkRangeId must have at least 36 elements") + } + if strlen(r.networkRangeId) > 36 { + return localVarReturnValue, fmt.Errorf("networkRangeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetworkAreaRange: Get details about a network range. + +Get details about a network range in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param networkRangeId The identifier (ID) of a STACKIT Network Range. + @return ApiGetNetworkAreaRangeRequest +*/ +func (a *APIClient) GetNetworkAreaRange(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) ApiGetNetworkAreaRangeRequest { + return GetNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } +} + +func (a *APIClient) GetNetworkAreaRangeExecute(ctx context.Context, organizationId string, areaId string, region string, networkRangeId string) (*NetworkRange, error) { + r := GetNetworkAreaRangeRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + networkRangeId: networkRangeId, + } + return r.Execute() +} + +type GetNetworkAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string +} + +func (r GetNetworkAreaRegionRequest) Execute() (*RegionalArea, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRegion") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetworkAreaRegion: Get details about a configured region. + +Get details about a configured region in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiGetNetworkAreaRegionRequest +*/ +func (a *APIClient) GetNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiGetNetworkAreaRegionRequest { + return GetNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) GetNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) { + r := GetNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type GetNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routeId string +} + +func (r GetNetworkAreaRouteRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNetworkAreaRoute") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNetworkAreaRoute: Get details about a network route. + +Get details about a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetNetworkAreaRouteRequest +*/ +func (a *APIClient) GetNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiGetNetworkAreaRouteRequest { + return GetNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } +} + +func (a *APIClient) GetNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) { + r := GetNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } + return r.Execute() +} + +type GetNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + nicId string +} + +func (r GetNicRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetNic") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetNic: Get details about a network interface. + +Get details about a network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiGetNicRequest +*/ +func (a *APIClient) GetNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiGetNicRequest { + return GetNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) GetNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) { + r := GetNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type GetOrganizationRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + requestId string +} + +func (r GetOrganizationRequestRequest) Execute() (*Request, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Request + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetOrganizationRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + } + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetOrganizationRequest: Lookup an organization request ID. + +Lookup an organization request ID from a previous request. This allows to find resource IDs of resources generated during a organization request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetOrganizationRequestRequest +*/ +func (a *APIClient) GetOrganizationRequest(ctx context.Context, organizationId string, requestId string) ApiGetOrganizationRequestRequest { + return GetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, + } +} + +func (a *APIClient) GetOrganizationRequestExecute(ctx context.Context, organizationId string, requestId string) (*Request, error) { + r := GetOrganizationRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + requestId: requestId, + } + return r.Execute() +} + +type GetProjectDetailsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r GetProjectDetailsRequest) Execute() (*Project, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Project + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectDetails") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetProjectDetails: Get project details. + +Get details about a STACKIT project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @return ApiGetProjectDetailsRequest +*/ +func (a *APIClient) GetProjectDetails(ctx context.Context, projectId string) ApiGetProjectDetailsRequest { + return GetProjectDetailsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) GetProjectDetailsExecute(ctx context.Context, projectId string) (*Project, error) { + r := GetProjectDetailsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type GetProjectNICRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + nicId string +} + +func (r GetProjectNICRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectNIC") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetProjectNIC: Get details about a network interface of a project. + +Get details about a network interface inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param nicId The identifier (ID) of a network interface. + @return ApiGetProjectNICRequest +*/ +func (a *APIClient) GetProjectNIC(ctx context.Context, projectId string, region string, nicId string) ApiGetProjectNICRequest { + return GetProjectNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + nicId: nicId, + } +} + +func (a *APIClient) GetProjectNICExecute(ctx context.Context, projectId string, region string, nicId string) (*NIC, error) { + r := GetProjectNICRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + nicId: nicId, + } + return r.Execute() +} + +type GetProjectRequestRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + requestId string +} + +func (r GetProjectRequestRequest) Execute() (*Request, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Request + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetProjectRequest") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/requests/{requestId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", url.PathEscape(ParameterValueToString(r.requestId, "requestId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.requestId) < 36 { + return localVarReturnValue, fmt.Errorf("requestId must have at least 36 elements") + } + if strlen(r.requestId) > 36 { + return localVarReturnValue, fmt.Errorf("requestId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetProjectRequest: Lookup a project request ID. + +Lookup a project request ID from a previous request. This allows to find resource IDs of resources generated during a projects request. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param requestId The identifier (ID) of a STACKIT Request. + @return ApiGetProjectRequestRequest +*/ +func (a *APIClient) GetProjectRequest(ctx context.Context, projectId string, region string, requestId string) ApiGetProjectRequestRequest { + return GetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + requestId: requestId, + } +} + +func (a *APIClient) GetProjectRequestExecute(ctx context.Context, projectId string, region string, requestId string) (*Request, error) { + r := GetProjectRequestRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + requestId: requestId, + } + return r.Execute() +} + +type GetPublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + publicIpId string +} + +func (r GetPublicIPRequest) Execute() (*PublicIp, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetPublicIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetPublicIP: Get details about a public IP. + +Get details about a public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiGetPublicIPRequest +*/ +func (a *APIClient) GetPublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiGetPublicIPRequest { + return GetPublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } +} + +func (a *APIClient) GetPublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) { + r := GetPublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } + return r.Execute() +} + +type GetRouteOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string +} + +func (r GetRouteOfRoutingTableRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRouteOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRouteOfRoutingTable: Get details about a route of a routing table. + +Get details about a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiGetRouteOfRoutingTableRequest +*/ +func (a *APIClient) GetRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiGetRouteOfRoutingTableRequest { + return GetRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) GetRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) { + r := GetRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type GetRoutingTableOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string +} + +func (r GetRoutingTableOfAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetRoutingTableOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetRoutingTableOfArea: Get details about a routing table. + +Get details about a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiGetRoutingTableOfAreaRequest +*/ +func (a *APIClient) GetRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiGetRoutingTableOfAreaRequest { + return GetRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) GetRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) { + r := GetRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type GetSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string +} + +func (r GetSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetSecurityGroup: Get security group details. + +Get details about a security group of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiGetSecurityGroupRequest +*/ +func (a *APIClient) GetSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiGetSecurityGroupRequest { + return GetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) GetSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) { + r := GetSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type GetSecurityGroupRuleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + securityGroupRuleId string +} + +func (r GetSecurityGroupRuleRequest) Execute() (*SecurityGroupRule, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRule + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSecurityGroupRule") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules/{securityGroupRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupRuleId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupRuleId, "securityGroupRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if strlen(r.securityGroupRuleId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have at least 36 elements") + } + if strlen(r.securityGroupRuleId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupRuleId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetSecurityGroupRule: Get security group rule details. + +Get details about a security group rule of a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @param securityGroupRuleId The identifier (ID) of a STACKIT Security Group Rule. + @return ApiGetSecurityGroupRuleRequest +*/ +func (a *APIClient) GetSecurityGroupRule(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) ApiGetSecurityGroupRuleRequest { + return GetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } +} + +func (a *APIClient) GetSecurityGroupRuleExecute(ctx context.Context, projectId string, region string, securityGroupId string, securityGroupRuleId string) (*SecurityGroupRule, error) { + r := GetSecurityGroupRuleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + securityGroupRuleId: securityGroupRuleId, + } + return r.Execute() +} + +type GetServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + details *bool +} + +// Show detailed information about server. + +func (r GetServerRequest) Details(details bool) ApiGetServerRequest { + r.details = &details + return r +} + +func (r GetServerRequest) Execute() (*Server, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetServer: Get server details. + +Get details about a server by its ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerRequest +*/ +func (a *APIClient) GetServer(ctx context.Context, projectId string, region string, serverId string) ApiGetServerRequest { + return GetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) GetServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) { + r := GetServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type GetServerConsoleRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r GetServerConsoleRequest) Execute() (*ServerConsoleUrl, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServerConsoleUrl + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerConsole") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/console" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetServerConsole: Get server console. + +Get a URL for server remote console. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerConsoleRequest +*/ +func (a *APIClient) GetServerConsole(ctx context.Context, projectId string, region string, serverId string) ApiGetServerConsoleRequest { + return GetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) GetServerConsoleExecute(ctx context.Context, projectId string, region string, serverId string) (*ServerConsoleUrl, error) { + r := GetServerConsoleRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type GetServerLogRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + length *int64 +} + +// Request the server log. By default the length is limited to 2000 lines. Set to 0 to retrieve the complete log. + +func (r GetServerLogRequest) Length(length int64) ApiGetServerLogRequest { + r.length = &length + return r +} + +func (r GetServerLogRequest) Execute() (*GetServerLog200Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetServerLog200Response + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetServerLog") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/log" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + if r.length != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "length", r.length, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetServerLog: Get server log. + +Get server console log. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiGetServerLogRequest +*/ +func (a *APIClient) GetServerLog(ctx context.Context, projectId string, region string, serverId string) ApiGetServerLogRequest { + return GetServerLogRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) GetServerLogExecute(ctx context.Context, projectId string, region string, serverId string) (*GetServerLog200Response, error) { + r := GetServerLogRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type GetSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + snapshotId string +} + +func (r GetSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetSnapshot: Get details about a snapshot. + +Get details about a block device snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiGetSnapshotRequest +*/ +func (a *APIClient) GetSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiGetSnapshotRequest { + return GetSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } +} + +func (a *APIClient) GetSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) { + r := GetSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } + return r.Execute() +} + +type GetVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string +} + +func (r GetVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVolume: Get details about a volume. + +Get details about a block device volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiGetVolumeRequest +*/ +func (a *APIClient) GetVolume(ctx context.Context, projectId string, region string, volumeId string) ApiGetVolumeRequest { + return GetVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) GetVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) { + r := GetVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} + +type GetVolumePerformanceClassRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumePerformanceClass string +} + +func (r GetVolumePerformanceClassRequest) Execute() (*VolumePerformanceClass, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumePerformanceClass + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetVolumePerformanceClass") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volume-performance-classes/{volumePerformanceClass}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumePerformanceClass"+"}", url.PathEscape(ParameterValueToString(r.volumePerformanceClass, "volumePerformanceClass")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumePerformanceClass) > 127 { + return localVarReturnValue, fmt.Errorf("volumePerformanceClass must have less than 127 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetVolumePerformanceClass: Get details about a volume performance class. + +Get details about a specific volume performance class. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumePerformanceClass The name of a STACKIT Volume performance class. + @return ApiGetVolumePerformanceClassRequest +*/ +func (a *APIClient) GetVolumePerformanceClass(ctx context.Context, projectId string, region string, volumePerformanceClass string) ApiGetVolumePerformanceClassRequest { + return GetVolumePerformanceClassRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumePerformanceClass: volumePerformanceClass, + } +} + +func (a *APIClient) GetVolumePerformanceClassExecute(ctx context.Context, projectId string, region string, volumePerformanceClass string) (*VolumePerformanceClass, error) { + r := GetVolumePerformanceClassRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumePerformanceClass: volumePerformanceClass, + } + return r.Execute() +} + +type ListAffinityGroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r ListAffinityGroupsRequest) Execute() (*AffinityGroupListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AffinityGroupListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAffinityGroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/affinity-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAffinityGroups: Get the affinity groups setup for a project. + +Get the affinity groups created in a project. Affinity groups are an indication of locality of a server relative to another group of servers. They can be either running on the same host (affinity) or on different ones (anti-affinity). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListAffinityGroupsRequest +*/ +func (a *APIClient) ListAffinityGroups(ctx context.Context, projectId string, region string) ApiListAffinityGroupsRequest { + return ListAffinityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListAffinityGroupsExecute(ctx context.Context, projectId string, region string) (*AffinityGroupListResponse, error) { + r := ListAffinityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListAttachedVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r ListAttachedVolumesRequest) Execute() (*VolumeAttachmentListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachmentListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAttachedVolumes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAttachedVolumes: List all volume attachments of a server. + +Get a list of all volume attachments of a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListAttachedVolumesRequest +*/ +func (a *APIClient) ListAttachedVolumes(ctx context.Context, projectId string, region string, serverId string) ApiListAttachedVolumesRequest { + return ListAttachedVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ListAttachedVolumesExecute(ctx context.Context, projectId string, region string, serverId string) (*VolumeAttachmentListResponse, error) { + r := ListAttachedVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ListAvailabilityZonesRequest struct { + ctx context.Context + apiService *DefaultApiService + region string +} + +func (r ListAvailabilityZonesRequest) Execute() (*AvailabilityZoneListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AvailabilityZoneListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAvailabilityZones") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/regions/{region}/availability-zones" + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListAvailabilityZones: List all availability zones. + +Get a list of all availability zones. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param region The STACKIT Region of the resources. + @return ApiListAvailabilityZonesRequest +*/ +func (a *APIClient) ListAvailabilityZones(ctx context.Context, region string) ApiListAvailabilityZonesRequest { + return ListAvailabilityZonesRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } +} + +func (a *APIClient) ListAvailabilityZonesExecute(ctx context.Context, region string) (*AvailabilityZoneListResponse, error) { + r := ListAvailabilityZonesRequest{ + apiService: a.defaultApi, + ctx: ctx, + region: region, + } + return r.Execute() +} + +type ListBackupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListBackupsRequest) LabelSelector(labelSelector string) ApiListBackupsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListBackupsRequest) Execute() (*BackupListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BackupListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListBackups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/backups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListBackups: List all backups inside a project. + +Get a list of all backups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListBackupsRequest +*/ +func (a *APIClient) ListBackups(ctx context.Context, projectId string, region string) ApiListBackupsRequest { + return ListBackupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListBackupsExecute(ctx context.Context, projectId string, region string) (*BackupListResponse, error) { + r := ListBackupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListImagesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + all *bool + labelSelector *string +} + +// List all Images. + +func (r ListImagesRequest) All(all bool) ApiListImagesRequest { + r.all = &all + return r +} + +// Filter resources by labels. + +func (r ListImagesRequest) LabelSelector(labelSelector string) ApiListImagesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListImagesRequest) Execute() (*ImageListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListImages") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.all != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "all", r.all, "") + } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListImages: List all Images inside a project. + +Get a list of all images inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListImagesRequest +*/ +func (a *APIClient) ListImages(ctx context.Context, projectId string, region string) ApiListImagesRequest { + return ListImagesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListImagesExecute(ctx context.Context, projectId string, region string) (*ImageListResponse, error) { + r := ListImagesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListKeyPairsRequest struct { + ctx context.Context + apiService *DefaultApiService + labelSelector *string +} + +// Filter resources by labels. + +func (r ListKeyPairsRequest) LabelSelector(labelSelector string) ApiListKeyPairsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListKeyPairsRequest) Execute() (*KeyPairListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *KeyPairListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListKeyPairs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/keypairs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListKeyPairs: List all SSH keypairs for the requesting user. + +Get a list of all SSH keypairs assigned to the requesting user. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListKeyPairsRequest +*/ +func (a *APIClient) ListKeyPairs(ctx context.Context) ApiListKeyPairsRequest { + return ListKeyPairsRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListKeyPairsExecute(ctx context.Context) (*KeyPairListResponse, error) { + r := ListKeyPairsRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ListMachineTypesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + filter *string +} + +// Filter resources by fields. A subset of expr-lang is supported. See https://expr-lang.org/docs/language-definition for usage details. + +func (r ListMachineTypesRequest) Filter(filter string) ApiListMachineTypesRequest { + r.filter = &filter + return r +} + +func (r ListMachineTypesRequest) Execute() (*MachineTypeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MachineTypeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListMachineTypes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/machine-types" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.filter != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "filter", r.filter, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListMachineTypes: List all machine types available for a project. + +Get a list of all machine type available in a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListMachineTypesRequest +*/ +func (a *APIClient) ListMachineTypes(ctx context.Context, projectId string, region string) ApiListMachineTypesRequest { + return ListMachineTypesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListMachineTypesExecute(ctx context.Context, projectId string, region string) (*MachineTypeListResponse, error) { + r := ListMachineTypesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListNetworkAreaProjectsRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ListNetworkAreaProjectsRequest) Execute() (*ProjectListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ProjectListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaProjects") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/projects" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreaProjects: List all projects using a network area. + +Get a list of all projects using a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaProjectsRequest +*/ +func (a *APIClient) ListNetworkAreaProjects(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaProjectsRequest { + return ListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) ListNetworkAreaProjectsExecute(ctx context.Context, organizationId string, areaId string) (*ProjectListResponse, error) { + r := ListNetworkAreaProjectsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ListNetworkAreaRangesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string +} + +func (r ListNetworkAreaRangesRequest) Execute() (*NetworkRangeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkRangeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRanges") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/network-ranges" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreaRanges: List all network ranges in a network area. + +Get a list of all network ranges in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRangesRequest +*/ +func (a *APIClient) ListNetworkAreaRanges(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRangesRequest { + return ListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) ListNetworkAreaRangesExecute(ctx context.Context, organizationId string, areaId string, region string) (*NetworkRangeListResponse, error) { + r := ListNetworkAreaRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type ListNetworkAreaRegionsRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string +} + +func (r ListNetworkAreaRegionsRequest) Execute() (*RegionalAreaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalAreaListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRegions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreaRegions: List all configured regions in a network area. + +Get a list of all configured regions. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiListNetworkAreaRegionsRequest +*/ +func (a *APIClient) ListNetworkAreaRegions(ctx context.Context, organizationId string, areaId string) ApiListNetworkAreaRegionsRequest { + return ListNetworkAreaRegionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) ListNetworkAreaRegionsExecute(ctx context.Context, organizationId string, areaId string) (*RegionalAreaListResponse, error) { + r := ListNetworkAreaRegionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type ListNetworkAreaRoutesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNetworkAreaRoutesRequest) LabelSelector(labelSelector string) ApiListNetworkAreaRoutesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNetworkAreaRoutesRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreaRoutes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreaRoutes: List all network routes in a network area. + +Get a list of all network routes defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListNetworkAreaRoutesRequest +*/ +func (a *APIClient) ListNetworkAreaRoutes(ctx context.Context, organizationId string, areaId string, region string) ApiListNetworkAreaRoutesRequest { + return ListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) ListNetworkAreaRoutesExecute(ctx context.Context, organizationId string, areaId string, region string) (*RouteListResponse, error) { + r := ListNetworkAreaRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type ListNetworkAreasRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNetworkAreasRequest) LabelSelector(labelSelector string) ApiListNetworkAreasRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNetworkAreasRequest) Execute() (*NetworkAreaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkAreaListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworkAreas") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworkAreas: List all network areas in an organization. + +Get a list of all visible network areas defined in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @return ApiListNetworkAreasRequest +*/ +func (a *APIClient) ListNetworkAreas(ctx context.Context, organizationId string) ApiListNetworkAreasRequest { + return ListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } +} + +func (a *APIClient) ListNetworkAreasExecute(ctx context.Context, organizationId string) (*NetworkAreaListResponse, error) { + r := ListNetworkAreasRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } + return r.Execute() +} + +type ListNetworksRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNetworksRequest) LabelSelector(labelSelector string) ApiListNetworksRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNetworksRequest) Execute() (*NetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNetworks") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNetworks: List all networks inside a project. + +Get a list of all networks inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListNetworksRequest +*/ +func (a *APIClient) ListNetworks(ctx context.Context, projectId string, region string) ApiListNetworksRequest { + return ListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListNetworksExecute(ctx context.Context, projectId string, region string) (*NetworkListResponse, error) { + r := ListNetworksRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListNicsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListNicsRequest) LabelSelector(labelSelector string) ApiListNicsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListNicsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListNics") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListNics: List all network interfaces inside a network. + +Get a list of all network interfaces inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiListNicsRequest +*/ +func (a *APIClient) ListNics(ctx context.Context, projectId string, region string, networkId string) ApiListNicsRequest { + return ListNicsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) ListNicsExecute(ctx context.Context, projectId string, region string, networkId string) (*NICListResponse, error) { + r := ListNicsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type ListProjectNICsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListProjectNICsRequest) LabelSelector(labelSelector string) ApiListProjectNICsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListProjectNICsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListProjectNICs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListProjectNICs: List all network interfaces inside a project. + +Get a list of all network interfaces inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListProjectNICsRequest +*/ +func (a *APIClient) ListProjectNICs(ctx context.Context, projectId string, region string) ApiListProjectNICsRequest { + return ListProjectNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListProjectNICsExecute(ctx context.Context, projectId string, region string) (*NICListResponse, error) { + r := ListProjectNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListPublicIPRangesRequest struct { + ctx context.Context + apiService *DefaultApiService +} + +func (r ListPublicIPRangesRequest) Execute() (*PublicNetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicNetworkListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIPRanges") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/networks/public-ip-ranges" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPublicIPRanges: List all public IP ranges. + +Get a list of all public IP ranges that STACKIT uses. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPublicIPRangesRequest +*/ +func (a *APIClient) ListPublicIPRanges(ctx context.Context) ApiListPublicIPRangesRequest { + return ListPublicIPRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListPublicIPRangesExecute(ctx context.Context) (*PublicNetworkListResponse, error) { + r := ListPublicIPRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + +type ListPublicIPsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListPublicIPsRequest) LabelSelector(labelSelector string) ApiListPublicIPsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListPublicIPsRequest) Execute() (*PublicIpListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIpListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIPs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/public-ips" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPublicIPs: List all public IPs inside a project. + +Get a list of all public IPs inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListPublicIPsRequest +*/ +func (a *APIClient) ListPublicIPs(ctx context.Context, projectId string, region string) ApiListPublicIPsRequest { + return ListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListPublicIPsExecute(ctx context.Context, projectId string, region string) (*PublicIpListResponse, error) { + r := ListPublicIPsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListQuotasRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string +} + +func (r ListQuotasRequest) Execute() (*QuotaListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *QuotaListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListQuotas") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/quotas" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListQuotas: List project quotas. + +List quota limits and usage for project resources. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListQuotasRequest +*/ +func (a *APIClient) ListQuotas(ctx context.Context, projectId string, region string) ApiListQuotasRequest { + return ListQuotasRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListQuotasExecute(ctx context.Context, projectId string, region string) (*QuotaListResponse, error) { + r := ListQuotasRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListRoutesOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListRoutesOfRoutingTableRequest) LabelSelector(labelSelector string) ApiListRoutesOfRoutingTableRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListRoutesOfRoutingTableRequest) Execute() (*RouteListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RouteListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRoutesOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRoutesOfRoutingTable: List all routes in a routing table. + +Get a list of all routes in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiListRoutesOfRoutingTableRequest +*/ +func (a *APIClient) ListRoutesOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiListRoutesOfRoutingTableRequest { + return ListRoutesOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) ListRoutesOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RouteListResponse, error) { + r := ListRoutesOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type ListRoutingTablesOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListRoutingTablesOfAreaRequest) LabelSelector(labelSelector string) ApiListRoutingTablesOfAreaRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListRoutingTablesOfAreaRequest) Execute() (*RoutingTableListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTableListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListRoutingTablesOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListRoutingTablesOfArea: List all routing tables in a network area. + +Get a list of all routing tables in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiListRoutingTablesOfAreaRequest +*/ +func (a *APIClient) ListRoutingTablesOfArea(ctx context.Context, organizationId string, areaId string, region string) ApiListRoutingTablesOfAreaRequest { + return ListRoutingTablesOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) ListRoutingTablesOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string) (*RoutingTableListResponse, error) { + r := ListRoutingTablesOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type ListSecurityGroupRulesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string +} + +func (r ListSecurityGroupRulesRequest) Execute() (*SecurityGroupRuleListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupRuleListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroupRules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}/rules" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListSecurityGroupRules: List all rules for a security group. + +Get a list of all rules inside a security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiListSecurityGroupRulesRequest +*/ +func (a *APIClient) ListSecurityGroupRules(ctx context.Context, projectId string, region string, securityGroupId string) ApiListSecurityGroupRulesRequest { + return ListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) ListSecurityGroupRulesExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroupRuleListResponse, error) { + r := ListSecurityGroupRulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type ListSecurityGroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListSecurityGroupsRequest) LabelSelector(labelSelector string) ApiListSecurityGroupsRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListSecurityGroupsRequest) Execute() (*SecurityGroupListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroupListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSecurityGroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListSecurityGroups: List all security groups inside a project. + +Get a list of all security groups inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListSecurityGroupsRequest +*/ +func (a *APIClient) ListSecurityGroups(ctx context.Context, projectId string, region string) ApiListSecurityGroupsRequest { + return ListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListSecurityGroupsExecute(ctx context.Context, projectId string, region string) (*SecurityGroupListResponse, error) { + r := ListSecurityGroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListServerNICsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r ListServerNICsRequest) Execute() (*NICListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NICListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerNICs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/nics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListServerNICs: Get all network interfaces. + +Get all network interfaces attached to the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerNICsRequest +*/ +func (a *APIClient) ListServerNICs(ctx context.Context, projectId string, region string, serverId string) ApiListServerNICsRequest { + return ListServerNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ListServerNICsExecute(ctx context.Context, projectId string, region string, serverId string) (*NICListResponse, error) { + r := ListServerNICsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ListServerServiceAccountsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r ListServerServiceAccountsRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServerServiceAccounts") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListServerServiceAccounts: List all service accounts of the Server. + +Get the list of the service accounts of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiListServerServiceAccountsRequest +*/ +func (a *APIClient) ListServerServiceAccounts(ctx context.Context, projectId string, region string, serverId string) ApiListServerServiceAccountsRequest { + return ListServerServiceAccountsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ListServerServiceAccountsExecute(ctx context.Context, projectId string, region string, serverId string) (*ServiceAccountMailListResponse, error) { + r := ListServerServiceAccountsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ListServersRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + details *bool + labelSelector *string +} + +// Show detailed information about server. + +func (r ListServersRequest) Details(details bool) ApiListServersRequest { + r.details = &details + return r +} + +// Filter resources by labels. + +func (r ListServersRequest) LabelSelector(labelSelector string) ApiListServersRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListServersRequest) Execute() (*ServerListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServerListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListServers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.details != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "details", r.details, "") + } + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListServers: List all servers inside a project. + +Get a list of all servers inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListServersRequest +*/ +func (a *APIClient) ListServers(ctx context.Context, projectId string, region string) ApiListServersRequest { + return ListServersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListServersExecute(ctx context.Context, projectId string, region string) (*ServerListResponse, error) { + r := ListServersRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListSnapshotsInProjectRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListSnapshotsInProjectRequest) LabelSelector(labelSelector string) ApiListSnapshotsInProjectRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListSnapshotsInProjectRequest) Execute() (*SnapshotListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SnapshotListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListSnapshotsInProject") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/snapshots" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListSnapshotsInProject: List all snapshots inside a project. + +Get a list of all snapshots inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListSnapshotsInProjectRequest +*/ +func (a *APIClient) ListSnapshotsInProject(ctx context.Context, projectId string, region string) ApiListSnapshotsInProjectRequest { + return ListSnapshotsInProjectRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListSnapshotsInProjectExecute(ctx context.Context, projectId string, region string) (*SnapshotListResponse, error) { + r := ListSnapshotsInProjectRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListVolumePerformanceClassesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListVolumePerformanceClassesRequest) LabelSelector(labelSelector string) ApiListVolumePerformanceClassesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListVolumePerformanceClassesRequest) Execute() (*VolumePerformanceClassListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumePerformanceClassListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumePerformanceClasses") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volume-performance-classes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListVolumePerformanceClasses: List all volume performance classes available for a project. + +Get a list of all volume performance classes available inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumePerformanceClassesRequest +*/ +func (a *APIClient) ListVolumePerformanceClasses(ctx context.Context, projectId string, region string) ApiListVolumePerformanceClassesRequest { + return ListVolumePerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListVolumePerformanceClassesExecute(ctx context.Context, projectId string, region string) (*VolumePerformanceClassListResponse, error) { + r := ListVolumePerformanceClassesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type ListVolumesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + labelSelector *string +} + +// Filter resources by labels. + +func (r ListVolumesRequest) LabelSelector(labelSelector string) ApiListVolumesRequest { + r.labelSelector = &labelSelector + return r +} + +func (r ListVolumesRequest) Execute() (*VolumeListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListVolumes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volumes" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + + if r.labelSelector != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListVolumes: List all volumes inside a project. + +Get a list of all volumes inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @return ApiListVolumesRequest +*/ +func (a *APIClient) ListVolumes(ctx context.Context, projectId string, region string) ApiListVolumesRequest { + return ListVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } +} + +func (a *APIClient) ListVolumesExecute(ctx context.Context, projectId string, region string) (*VolumeListResponse, error) { + r := ListVolumesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + } + return r.Execute() +} + +type PartialUpdateNetworkRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + partialUpdateNetworkPayload *PartialUpdateNetworkPayload +} + +// Request an update of a network. + +func (r PartialUpdateNetworkRequest) PartialUpdateNetworkPayload(partialUpdateNetworkPayload PartialUpdateNetworkPayload) ApiPartialUpdateNetworkRequest { + r.partialUpdateNetworkPayload = &partialUpdateNetworkPayload + return r +} + +func (r PartialUpdateNetworkRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetwork") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + if r.partialUpdateNetworkPayload == nil { + return fmt.Errorf("partialUpdateNetworkPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.partialUpdateNetworkPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +PartialUpdateNetwork: Update network settings. + +Update the settings of a network inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiPartialUpdateNetworkRequest +*/ +func (a *APIClient) PartialUpdateNetwork(ctx context.Context, projectId string, region string, networkId string) ApiPartialUpdateNetworkRequest { + return PartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } +} + +func (a *APIClient) PartialUpdateNetworkExecute(ctx context.Context, projectId string, region string, networkId string) error { + r := PartialUpdateNetworkRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + } + return r.Execute() +} + +type PartialUpdateNetworkAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + partialUpdateNetworkAreaPayload *PartialUpdateNetworkAreaPayload +} + +// Request to update an Area. + +func (r PartialUpdateNetworkAreaRequest) PartialUpdateNetworkAreaPayload(partialUpdateNetworkAreaPayload PartialUpdateNetworkAreaPayload) ApiPartialUpdateNetworkAreaRequest { + r.partialUpdateNetworkAreaPayload = &partialUpdateNetworkAreaPayload + return r +} + +func (r PartialUpdateNetworkAreaRequest) Execute() (*NetworkArea, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NetworkArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateNetworkArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.partialUpdateNetworkAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("partialUpdateNetworkAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.partialUpdateNetworkAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PartialUpdateNetworkArea: Update network area settings. + +Update the settings of a network area in an organization. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @return ApiPartialUpdateNetworkAreaRequest +*/ +func (a *APIClient) PartialUpdateNetworkArea(ctx context.Context, organizationId string, areaId string) ApiPartialUpdateNetworkAreaRequest { + return PartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } +} + +func (a *APIClient) PartialUpdateNetworkAreaExecute(ctx context.Context, organizationId string, areaId string) (*NetworkArea, error) { + r := PartialUpdateNetworkAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + } + return r.Execute() +} + +type RebootServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + action *string +} + +// Defines if it is a soft or a hard reboot. + +func (r RebootServerRequest) Action(action string) ApiRebootServerRequest { + r.action = &action + return r +} + +func (r RebootServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RebootServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/reboot" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + if r.action != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "action", r.action, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RebootServer: Reboot the server. + +Reboot the server. A soft reboot will attempt to gracefully shut down the server by passing the command to the operating system. A hard reboot will power cycle the server without waiting for the operating system to shutdown properly. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRebootServerRequest +*/ +func (a *APIClient) RebootServer(ctx context.Context, projectId string, region string, serverId string) ApiRebootServerRequest { + return RebootServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) RebootServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := RebootServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type RemoveNetworkFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + networkId string +} + +func (r RemoveNetworkFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNetworkFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/networks/{networkId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return fmt.Errorf("networkId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveNetworkFromServer: Detach and delete all network interfaces associated with the specified network. + +Detach and delete all network interfaces associated with the specified network from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param networkId The identifier (ID) of a STACKIT Network. + @return ApiRemoveNetworkFromServerRequest +*/ +func (a *APIClient) RemoveNetworkFromServer(ctx context.Context, projectId string, region string, serverId string, networkId string) ApiRemoveNetworkFromServerRequest { + return RemoveNetworkFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } +} + +func (a *APIClient) RemoveNetworkFromServerExecute(ctx context.Context, projectId string, region string, serverId string, networkId string) error { + r := RemoveNetworkFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + networkId: networkId, + } + return r.Execute() +} + +type RemoveNicFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + nicId string +} + +func (r RemoveNicFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveNicFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return fmt.Errorf("nicId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveNicFromServer: Detach a network interface. + +Detach a network interface from a server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param nicId The identifier (ID) of a network interface. + @return ApiRemoveNicFromServerRequest +*/ +func (a *APIClient) RemoveNicFromServer(ctx context.Context, projectId string, region string, serverId string, nicId string) ApiRemoveNicFromServerRequest { + return RemoveNicFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } +} + +func (a *APIClient) RemoveNicFromServerExecute(ctx context.Context, projectId string, region string, serverId string, nicId string) error { + r := RemoveNicFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + nicId: nicId, + } + return r.Execute() +} + +type RemovePublicIpFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + publicIpId string +} + +func (r RemovePublicIpFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemovePublicIpFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return fmt.Errorf("publicIpId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemovePublicIpFromServer: Dissociate a public IP from a server. + +Dissociate a public IP on an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiRemovePublicIpFromServerRequest +*/ +func (a *APIClient) RemovePublicIpFromServer(ctx context.Context, projectId string, region string, serverId string, publicIpId string) ApiRemovePublicIpFromServerRequest { + return RemovePublicIpFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } +} + +func (a *APIClient) RemovePublicIpFromServerExecute(ctx context.Context, projectId string, region string, serverId string, publicIpId string) error { + r := RemovePublicIpFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + publicIpId: publicIpId, + } + return r.Execute() +} + +type RemoveSecurityGroupFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + securityGroupId string +} + +func (r RemoveSecurityGroupFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveSecurityGroupFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return fmt.Errorf("securityGroupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveSecurityGroupFromServer: Remove a server from a security group. + +Remove a server from a attached security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiRemoveSecurityGroupFromServerRequest +*/ +func (a *APIClient) RemoveSecurityGroupFromServer(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) ApiRemoveSecurityGroupFromServerRequest { + return RemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) RemoveSecurityGroupFromServerExecute(ctx context.Context, projectId string, region string, serverId string, securityGroupId string) error { + r := RemoveSecurityGroupFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type RemoveServiceAccountFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + serviceAccountMail string +} + +func (r RemoveServiceAccountFromServerRequest) Execute() (*ServiceAccountMailListResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ServiceAccountMailListResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveServiceAccountFromServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/service-accounts/{serviceAccountMail}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serviceAccountMail"+"}", url.PathEscape(ParameterValueToString(r.serviceAccountMail, "serviceAccountMail")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.serviceAccountMail) > 255 { + return localVarReturnValue, fmt.Errorf("serviceAccountMail must have less than 255 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +RemoveServiceAccountFromServer: Detach a service account from a server. + +Detach an additional service account from the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param serviceAccountMail The e-mail address of a service account. + @return ApiRemoveServiceAccountFromServerRequest +*/ +func (a *APIClient) RemoveServiceAccountFromServer(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) ApiRemoveServiceAccountFromServerRequest { + return RemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } +} + +func (a *APIClient) RemoveServiceAccountFromServerExecute(ctx context.Context, projectId string, region string, serverId string, serviceAccountMail string) (*ServiceAccountMailListResponse, error) { + r := RemoveServiceAccountFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + serviceAccountMail: serviceAccountMail, + } + return r.Execute() +} + +type RemoveVolumeFromServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string +} + +func (r RemoveVolumeFromServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RemoveVolumeFromServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RemoveVolumeFromServer: Detach a volume from a server. + +Detach an existing volume from an existing server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiRemoveVolumeFromServerRequest +*/ +func (a *APIClient) RemoveVolumeFromServer(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiRemoveVolumeFromServerRequest { + return RemoveVolumeFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) RemoveVolumeFromServerExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) error { + r := RemoveVolumeFromServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type RescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + rescueServerPayload *RescueServerPayload +} + +// Request a server rescue. + +func (r RescueServerRequest) RescueServerPayload(rescueServerPayload RescueServerPayload) ApiRescueServerRequest { + r.rescueServerPayload = &rescueServerPayload + return r +} + +func (r RescueServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RescueServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/rescue" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if r.rescueServerPayload == nil { + return fmt.Errorf("rescueServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.rescueServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RescueServer: Rescue an existing server. + +Rescue an existing server. It is shutdown and the initial image is attached as the boot volume, while the boot volume is attached as secondary volume and the server is booted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiRescueServerRequest +*/ +func (a *APIClient) RescueServer(ctx context.Context, projectId string, region string, serverId string) ApiRescueServerRequest { + return RescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) RescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := RescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ResizeServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + resizeServerPayload *ResizeServerPayload +} + +// Request a resize of a server. + +func (r ResizeServerRequest) ResizeServerPayload(resizeServerPayload ResizeServerPayload) ApiResizeServerRequest { + r.resizeServerPayload = &resizeServerPayload + return r +} + +func (r ResizeServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/resize" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + if r.resizeServerPayload == nil { + return fmt.Errorf("resizeServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.resizeServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +ResizeServer: Resize a server. + +Resize the server to the given machine type. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiResizeServerRequest +*/ +func (a *APIClient) ResizeServer(ctx context.Context, projectId string, region string, serverId string) ApiResizeServerRequest { + return ResizeServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) ResizeServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := ResizeServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type ResizeVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string + resizeVolumePayload *ResizeVolumePayload +} + +// Request a volume resize. + +func (r ResizeVolumeRequest) ResizeVolumePayload(resizeVolumePayload ResizeVolumePayload) ApiResizeVolumeRequest { + r.resizeVolumePayload = &resizeVolumePayload + return r +} + +func (r ResizeVolumeRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResizeVolume") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volumes/{volumeId}/resize" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return fmt.Errorf("volumeId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.resizeVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +ResizeVolume: Update the size of a volume. + +Update the size of a block device volume. The new volume size must be larger than the current size. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiResizeVolumeRequest +*/ +func (a *APIClient) ResizeVolume(ctx context.Context, projectId string, region string, volumeId string) ApiResizeVolumeRequest { + return ResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) ResizeVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) error { + r := ResizeVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} + +type RestoreBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string +} + +func (r RestoreBackupRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.RestoreBackup") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/backups/{backupId}/restore" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return fmt.Errorf("backupId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +RestoreBackup: Restore Backup to the referenced source Volume. + +Restores a Backup to the existing Volume it references to. The use of this endpoint is disruptive as the volume needs to be detached. If a new volume is to be created use the volumes endpoint with the option to create from backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiRestoreBackupRequest +*/ +func (a *APIClient) RestoreBackup(ctx context.Context, projectId string, region string, backupId string) ApiRestoreBackupRequest { + return RestoreBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) RestoreBackupExecute(ctx context.Context, projectId string, region string, backupId string) error { + r := RestoreBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type SetImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + setImageSharePayload *SetImageSharePayload +} + +// Settings for an Image Share. + +func (r SetImageShareRequest) SetImageSharePayload(setImageSharePayload SetImageSharePayload) ApiSetImageShareRequest { + r.setImageSharePayload = &setImageSharePayload + return r +} + +func (r SetImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.SetImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if r.setImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("setImageSharePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.setImageSharePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +SetImageShare: Set image share. + +Set share of an Image. New Options will replace existing settings. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiSetImageShareRequest +*/ +func (a *APIClient) SetImageShare(ctx context.Context, projectId string, region string, imageId string) ApiSetImageShareRequest { + return SetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) SetImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) { + r := SetImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type StartServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r StartServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StartServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/start" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +StartServer: Boot up a server. + +Start an existing server or allocates the server if deallocated. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStartServerRequest +*/ +func (a *APIClient) StartServer(ctx context.Context, projectId string, region string, serverId string) ApiStartServerRequest { + return StartServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) StartServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := StartServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type StopServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r StopServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.StopServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/stop" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +StopServer: Stop an existing server. + +Stops an existing server. The server will remain on the Hypervisor and will be charged full price for all resources attached to it. The attached resources will remain reserved. Useful particularly for vGPU servers. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiStopServerRequest +*/ +func (a *APIClient) StopServer(ctx context.Context, projectId string, region string, serverId string) ApiStopServerRequest { + return StopServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) StopServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := StopServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type UnrescueServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string +} + +func (r UnrescueServerRequest) Execute() error { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UnrescueServer") + if err != nil { + return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/unrescue" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return fmt.Errorf("serverId must have less than 36 elements") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return newErr + } + + return nil +} + +/* +UnrescueServer: Unrescue an existing server. + +Unrescue an existing server. The original boot volume is attached as boot volume of the server and the server is booted up. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUnrescueServerRequest +*/ +func (a *APIClient) UnrescueServer(ctx context.Context, projectId string, region string, serverId string) ApiUnrescueServerRequest { + return UnrescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) UnrescueServerExecute(ctx context.Context, projectId string, region string, serverId string) error { + r := UnrescueServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type UpdateAttachedVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + volumeId string + updateAttachedVolumePayload *UpdateAttachedVolumePayload +} + +// Request a volume attachment update. + +func (r UpdateAttachedVolumeRequest) UpdateAttachedVolumePayload(updateAttachedVolumePayload UpdateAttachedVolumePayload) ApiUpdateAttachedVolumeRequest { + r.updateAttachedVolumePayload = &updateAttachedVolumePayload + return r +} + +func (r UpdateAttachedVolumeRequest) Execute() (*VolumeAttachment, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VolumeAttachment + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAttachedVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}/volume-attachments/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + if r.updateAttachedVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("updateAttachedVolumePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAttachedVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateAttachedVolume: Update Volume Attachment Parameters. + +Update the properties of an existing Volume Attachment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateAttachedVolumeRequest +*/ +func (a *APIClient) UpdateAttachedVolume(ctx context.Context, projectId string, region string, serverId string, volumeId string) ApiUpdateAttachedVolumeRequest { + return UpdateAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } +} + +func (a *APIClient) UpdateAttachedVolumeExecute(ctx context.Context, projectId string, region string, serverId string, volumeId string) (*VolumeAttachment, error) { + r := UpdateAttachedVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + volumeId: volumeId, + } + return r.Execute() +} + +type UpdateBackupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + backupId string + updateBackupPayload *UpdateBackupPayload +} + +// Request an update of a backup. + +func (r UpdateBackupRequest) UpdateBackupPayload(updateBackupPayload UpdateBackupPayload) ApiUpdateBackupRequest { + r.updateBackupPayload = &updateBackupPayload + return r +} + +func (r UpdateBackupRequest) Execute() (*Backup, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Backup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateBackup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/backups/{backupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupId"+"}", url.PathEscape(ParameterValueToString(r.backupId, "backupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.backupId) < 36 { + return localVarReturnValue, fmt.Errorf("backupId must have at least 36 elements") + } + if strlen(r.backupId) > 36 { + return localVarReturnValue, fmt.Errorf("backupId must have less than 36 elements") + } + if r.updateBackupPayload == nil { + return localVarReturnValue, fmt.Errorf("updateBackupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateBackupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateBackup: Update information of a backup. + +Update name or labels of the backup. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param backupId The identifier (ID) of a STACKIT Backup. + @return ApiUpdateBackupRequest +*/ +func (a *APIClient) UpdateBackup(ctx context.Context, projectId string, region string, backupId string) ApiUpdateBackupRequest { + return UpdateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } +} + +func (a *APIClient) UpdateBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) { + r := UpdateBackupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + backupId: backupId, + } + return r.Execute() +} + +type UpdateImageRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + updateImagePayload *UpdateImagePayload +} + +// Request an update of an Image. + +func (r UpdateImageRequest) UpdateImagePayload(updateImagePayload UpdateImagePayload) ApiUpdateImageRequest { + r.updateImagePayload = &updateImagePayload + return r +} + +func (r UpdateImageRequest) Execute() (*Image, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Image + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImage") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if r.updateImagePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImagePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateImagePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateImage: Update Image Parameters. + +Update the properties of an existing Image inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageRequest +*/ +func (a *APIClient) UpdateImage(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageRequest { + return UpdateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) UpdateImageExecute(ctx context.Context, projectId string, region string, imageId string) (*Image, error) { + r := UpdateImageRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type UpdateImageShareRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + imageId string + updateImageSharePayload *UpdateImageSharePayload +} + +// Update an Image Share. + +func (r UpdateImageShareRequest) UpdateImageSharePayload(updateImageSharePayload UpdateImageSharePayload) ApiUpdateImageShareRequest { + r.updateImageSharePayload = &updateImageSharePayload + return r +} + +func (r UpdateImageShareRequest) Execute() (*ImageShare, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ImageShare + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateImageShare") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/images/{imageId}/share" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", url.PathEscape(ParameterValueToString(r.imageId, "imageId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.imageId) < 36 { + return localVarReturnValue, fmt.Errorf("imageId must have at least 36 elements") + } + if strlen(r.imageId) > 36 { + return localVarReturnValue, fmt.Errorf("imageId must have less than 36 elements") + } + if r.updateImageSharePayload == nil { + return localVarReturnValue, fmt.Errorf("updateImageSharePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateImageSharePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateImageShare: Update image share. + +Update share of an Image. Projects will be appended to existing list. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param imageId The identifier (ID) of a STACKIT Image. + @return ApiUpdateImageShareRequest +*/ +func (a *APIClient) UpdateImageShare(ctx context.Context, projectId string, region string, imageId string) ApiUpdateImageShareRequest { + return UpdateImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } +} + +func (a *APIClient) UpdateImageShareExecute(ctx context.Context, projectId string, region string, imageId string) (*ImageShare, error) { + r := UpdateImageShareRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + imageId: imageId, + } + return r.Execute() +} + +type UpdateKeyPairRequest struct { + ctx context.Context + apiService *DefaultApiService + keypairName string + updateKeyPairPayload *UpdateKeyPairPayload +} + +// Request an update of an SSH keypair. + +func (r UpdateKeyPairRequest) UpdateKeyPairPayload(updateKeyPairPayload UpdateKeyPairPayload) ApiUpdateKeyPairRequest { + r.updateKeyPairPayload = &updateKeyPairPayload + return r +} + +func (r UpdateKeyPairRequest) Execute() (*Keypair, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Keypair + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateKeyPair") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/keypairs/{keypairName}" + localVarPath = strings.Replace(localVarPath, "{"+"keypairName"+"}", url.PathEscape(ParameterValueToString(r.keypairName, "keypairName")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.keypairName) > 127 { + return localVarReturnValue, fmt.Errorf("keypairName must have less than 127 elements") + } + if r.updateKeyPairPayload == nil { + return localVarReturnValue, fmt.Errorf("updateKeyPairPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateKeyPairPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateKeyPair: Update information of an SSH keypair. + +Update labels of the SSH keypair. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param keypairName The name of an SSH keypair. + @return ApiUpdateKeyPairRequest +*/ +func (a *APIClient) UpdateKeyPair(ctx context.Context, keypairName string) ApiUpdateKeyPairRequest { + return UpdateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } +} + +func (a *APIClient) UpdateKeyPairExecute(ctx context.Context, keypairName string) (*Keypair, error) { + r := UpdateKeyPairRequest{ + apiService: a.defaultApi, + ctx: ctx, + keypairName: keypairName, + } + return r.Execute() +} + +type UpdateNetworkAreaRegionRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + updateNetworkAreaRegionPayload *UpdateNetworkAreaRegionPayload +} + +// Request an update of a regional network area. + +func (r UpdateNetworkAreaRegionRequest) UpdateNetworkAreaRegionPayload(updateNetworkAreaRegionPayload UpdateNetworkAreaRegionPayload) ApiUpdateNetworkAreaRegionRequest { + r.updateNetworkAreaRegionPayload = &updateNetworkAreaRegionPayload + return r +} + +func (r UpdateNetworkAreaRegionRequest) Execute() (*RegionalArea, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RegionalArea + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateNetworkAreaRegion") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if r.updateNetworkAreaRegionPayload == nil { + return localVarReturnValue, fmt.Errorf("updateNetworkAreaRegionPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateNetworkAreaRegionPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateNetworkAreaRegion: Update a region for a network area. + +Update a new region for a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @return ApiUpdateNetworkAreaRegionRequest +*/ +func (a *APIClient) UpdateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiUpdateNetworkAreaRegionRequest { + return UpdateNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } +} + +func (a *APIClient) UpdateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) { + r := UpdateNetworkAreaRegionRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + } + return r.Execute() +} + +type UpdateNetworkAreaRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routeId string + updateNetworkAreaRoutePayload *UpdateNetworkAreaRoutePayload +} + +// Request an update of a network route. + +func (r UpdateNetworkAreaRouteRequest) UpdateNetworkAreaRoutePayload(updateNetworkAreaRoutePayload UpdateNetworkAreaRoutePayload) ApiUpdateNetworkAreaRouteRequest { + r.updateNetworkAreaRoutePayload = &updateNetworkAreaRoutePayload + return r +} + +func (r UpdateNetworkAreaRouteRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateNetworkAreaRoute") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + if r.updateNetworkAreaRoutePayload == nil { + return localVarReturnValue, fmt.Errorf("updateNetworkAreaRoutePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateNetworkAreaRoutePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateNetworkAreaRoute: Update a network route. + +Update a network route defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateNetworkAreaRouteRequest +*/ +func (a *APIClient) UpdateNetworkAreaRoute(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiUpdateNetworkAreaRouteRequest { + return UpdateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } +} + +func (a *APIClient) UpdateNetworkAreaRouteExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) { + r := UpdateNetworkAreaRouteRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routeId: routeId, + } + return r.Execute() +} + +type UpdateNicRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + networkId string + nicId string + updateNicPayload *UpdateNicPayload +} + +// Request an update of a network interface. + +func (r UpdateNicRequest) UpdateNicPayload(updateNicPayload UpdateNicPayload) ApiUpdateNicRequest { + r.updateNicPayload = &updateNicPayload + return r +} + +func (r UpdateNicRequest) Execute() (*NIC, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *NIC + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateNic") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/networks/{networkId}/nics/{nicId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkId"+"}", url.PathEscape(ParameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", url.PathEscape(ParameterValueToString(r.nicId, "nicId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.networkId) < 36 { + return localVarReturnValue, fmt.Errorf("networkId must have at least 36 elements") + } + if strlen(r.networkId) > 36 { + return localVarReturnValue, fmt.Errorf("networkId must have less than 36 elements") + } + if strlen(r.nicId) < 36 { + return localVarReturnValue, fmt.Errorf("nicId must have at least 36 elements") + } + if strlen(r.nicId) > 36 { + return localVarReturnValue, fmt.Errorf("nicId must have less than 36 elements") + } + if r.updateNicPayload == nil { + return localVarReturnValue, fmt.Errorf("updateNicPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateNicPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 409 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateNic: Update a network interface. + +Update the properties of an existing network interface inside a network. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param networkId The identifier (ID) of a STACKIT Network. + @param nicId The identifier (ID) of a network interface. + @return ApiUpdateNicRequest +*/ +func (a *APIClient) UpdateNic(ctx context.Context, projectId string, region string, networkId string, nicId string) ApiUpdateNicRequest { + return UpdateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } +} + +func (a *APIClient) UpdateNicExecute(ctx context.Context, projectId string, region string, networkId string, nicId string) (*NIC, error) { + r := UpdateNicRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + networkId: networkId, + nicId: nicId, + } + return r.Execute() +} + +type UpdatePublicIPRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + publicIpId string + updatePublicIPPayload *UpdatePublicIPPayload +} + +// Request an update of a public IP. + +func (r UpdatePublicIPRequest) UpdatePublicIPPayload(updatePublicIPPayload UpdatePublicIPPayload) ApiUpdatePublicIPRequest { + r.updatePublicIPPayload = &updatePublicIPPayload + return r +} + +func (r UpdatePublicIPRequest) Execute() (*PublicIp, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicIp + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdatePublicIP") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/public-ips/{publicIpId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicIpId"+"}", url.PathEscape(ParameterValueToString(r.publicIpId, "publicIpId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.publicIpId) < 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have at least 36 elements") + } + if strlen(r.publicIpId) > 36 { + return localVarReturnValue, fmt.Errorf("publicIpId must have less than 36 elements") + } + if r.updatePublicIPPayload == nil { + return localVarReturnValue, fmt.Errorf("updatePublicIPPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updatePublicIPPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdatePublicIP: Update a public IP. + +Update the properties of an existing public IP inside a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param publicIpId The identifier (ID) of a Public IP. + @return ApiUpdatePublicIPRequest +*/ +func (a *APIClient) UpdatePublicIP(ctx context.Context, projectId string, region string, publicIpId string) ApiUpdatePublicIPRequest { + return UpdatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } +} + +func (a *APIClient) UpdatePublicIPExecute(ctx context.Context, projectId string, region string, publicIpId string) (*PublicIp, error) { + r := UpdatePublicIPRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + publicIpId: publicIpId, + } + return r.Execute() +} + +type UpdateRouteOfRoutingTableRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + routeId string + updateRouteOfRoutingTablePayload *UpdateRouteOfRoutingTablePayload +} + +// Request an update of a route in a routing table. + +func (r UpdateRouteOfRoutingTableRequest) UpdateRouteOfRoutingTablePayload(updateRouteOfRoutingTablePayload UpdateRouteOfRoutingTablePayload) ApiUpdateRouteOfRoutingTableRequest { + r.updateRouteOfRoutingTablePayload = &updateRouteOfRoutingTablePayload + return r +} + +func (r UpdateRouteOfRoutingTableRequest) Execute() (*Route, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Route + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateRouteOfRoutingTable") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}/routes/{routeId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routeId"+"}", url.PathEscape(ParameterValueToString(r.routeId, "routeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if strlen(r.routeId) < 36 { + return localVarReturnValue, fmt.Errorf("routeId must have at least 36 elements") + } + if strlen(r.routeId) > 36 { + return localVarReturnValue, fmt.Errorf("routeId must have less than 36 elements") + } + if r.updateRouteOfRoutingTablePayload == nil { + return localVarReturnValue, fmt.Errorf("updateRouteOfRoutingTablePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRouteOfRoutingTablePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateRouteOfRoutingTable: Update a route of a routing table. + +Update a route defined in a routing table. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @param routeId The identifier (ID) of a STACKIT Route. + @return ApiUpdateRouteOfRoutingTableRequest +*/ +func (a *APIClient) UpdateRouteOfRoutingTable(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) ApiUpdateRouteOfRoutingTableRequest { + return UpdateRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } +} + +func (a *APIClient) UpdateRouteOfRoutingTableExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string, routeId string) (*Route, error) { + r := UpdateRouteOfRoutingTableRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + routeId: routeId, + } + return r.Execute() +} + +type UpdateRoutingTableOfAreaRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + areaId string + region string + routingTableId string + updateRoutingTableOfAreaPayload *UpdateRoutingTableOfAreaPayload +} + +// Request an update of a routing table. + +func (r UpdateRoutingTableOfAreaRequest) UpdateRoutingTableOfAreaPayload(updateRoutingTableOfAreaPayload UpdateRoutingTableOfAreaPayload) ApiUpdateRoutingTableOfAreaRequest { + r.updateRoutingTableOfAreaPayload = &updateRoutingTableOfAreaPayload + return r +} + +func (r UpdateRoutingTableOfAreaRequest) Execute() (*RoutingTable, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RoutingTable + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateRoutingTableOfArea") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}/network-areas/{areaId}/regions/{region}/routing-tables/{routingTableId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"areaId"+"}", url.PathEscape(ParameterValueToString(r.areaId, "areaId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"routingTableId"+"}", url.PathEscape(ParameterValueToString(r.routingTableId, "routingTableId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.organizationId) < 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have at least 36 elements") + } + if strlen(r.organizationId) > 36 { + return localVarReturnValue, fmt.Errorf("organizationId must have less than 36 elements") + } + if strlen(r.areaId) < 36 { + return localVarReturnValue, fmt.Errorf("areaId must have at least 36 elements") + } + if strlen(r.areaId) > 36 { + return localVarReturnValue, fmt.Errorf("areaId must have less than 36 elements") + } + if strlen(r.routingTableId) < 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have at least 36 elements") + } + if strlen(r.routingTableId) > 36 { + return localVarReturnValue, fmt.Errorf("routingTableId must have less than 36 elements") + } + if r.updateRoutingTableOfAreaPayload == nil { + return localVarReturnValue, fmt.Errorf("updateRoutingTableOfAreaPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateRoutingTableOfAreaPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateRoutingTableOfArea: Update a routing table. + +Update a routing table defined in a network area. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId The identifier (ID) of a STACKIT Organization. + @param areaId The identifier (ID) of a STACKIT Network Area. + @param region The STACKIT Region of the resources. + @param routingTableId The identifier (ID) of a STACKIT Routing Table. + @return ApiUpdateRoutingTableOfAreaRequest +*/ +func (a *APIClient) UpdateRoutingTableOfArea(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) ApiUpdateRoutingTableOfAreaRequest { + return UpdateRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } +} + +func (a *APIClient) UpdateRoutingTableOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routingTableId string) (*RoutingTable, error) { + r := UpdateRoutingTableOfAreaRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + areaId: areaId, + region: region, + routingTableId: routingTableId, + } + return r.Execute() +} + +type UpdateSecurityGroupRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + securityGroupId string + updateSecurityGroupPayload *UpdateSecurityGroupPayload +} + +// Request an update of a security group. + +func (r UpdateSecurityGroupRequest) UpdateSecurityGroupPayload(updateSecurityGroupPayload UpdateSecurityGroupPayload) ApiUpdateSecurityGroupRequest { + r.updateSecurityGroupPayload = &updateSecurityGroupPayload + return r +} + +func (r UpdateSecurityGroupRequest) Execute() (*SecurityGroup, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SecurityGroup + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateSecurityGroup") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/security-groups/{securityGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", url.PathEscape(ParameterValueToString(r.securityGroupId, "securityGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.securityGroupId) < 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have at least 36 elements") + } + if strlen(r.securityGroupId) > 36 { + return localVarReturnValue, fmt.Errorf("securityGroupId must have less than 36 elements") + } + if r.updateSecurityGroupPayload == nil { + return localVarReturnValue, fmt.Errorf("updateSecurityGroupPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateSecurityGroupPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateSecurityGroup: Update information of a security group. + +Update labels of the security group. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param securityGroupId The identifier (ID) of a STACKIT Security Group. + @return ApiUpdateSecurityGroupRequest +*/ +func (a *APIClient) UpdateSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiUpdateSecurityGroupRequest { + return UpdateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } +} + +func (a *APIClient) UpdateSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) { + r := UpdateSecurityGroupRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + securityGroupId: securityGroupId, + } + return r.Execute() +} + +type UpdateServerRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + serverId string + updateServerPayload *UpdateServerPayload +} + +// Request an update of a server. + +func (r UpdateServerRequest) UpdateServerPayload(updateServerPayload UpdateServerPayload) ApiUpdateServerRequest { + r.updateServerPayload = &updateServerPayload + return r +} + +func (r UpdateServerRequest) Execute() (*Server, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Server + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateServer") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/servers/{serverId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", url.PathEscape(ParameterValueToString(r.serverId, "serverId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.serverId) < 36 { + return localVarReturnValue, fmt.Errorf("serverId must have at least 36 elements") + } + if strlen(r.serverId) > 36 { + return localVarReturnValue, fmt.Errorf("serverId must have less than 36 elements") + } + if r.updateServerPayload == nil { + return localVarReturnValue, fmt.Errorf("updateServerPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateServerPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateServer: Update information of a server. + +Update name or labels of the server. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param serverId The identifier (ID) of a STACKIT Server. + @return ApiUpdateServerRequest +*/ +func (a *APIClient) UpdateServer(ctx context.Context, projectId string, region string, serverId string) ApiUpdateServerRequest { + return UpdateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } +} + +func (a *APIClient) UpdateServerExecute(ctx context.Context, projectId string, region string, serverId string) (*Server, error) { + r := UpdateServerRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + serverId: serverId, + } + return r.Execute() +} + +type UpdateSnapshotRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + snapshotId string + updateSnapshotPayload *UpdateSnapshotPayload +} + +// Request an update of a snapshot. + +func (r UpdateSnapshotRequest) UpdateSnapshotPayload(updateSnapshotPayload UpdateSnapshotPayload) ApiUpdateSnapshotRequest { + r.updateSnapshotPayload = &updateSnapshotPayload + return r +} + +func (r UpdateSnapshotRequest) Execute() (*Snapshot, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Snapshot + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateSnapshot") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/snapshots/{snapshotId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", url.PathEscape(ParameterValueToString(r.snapshotId, "snapshotId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.snapshotId) < 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have at least 36 elements") + } + if strlen(r.snapshotId) > 36 { + return localVarReturnValue, fmt.Errorf("snapshotId must have less than 36 elements") + } + if r.updateSnapshotPayload == nil { + return localVarReturnValue, fmt.Errorf("updateSnapshotPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateSnapshotPayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateSnapshot: Update information of the snapshot. + +Update information like name or labels of the snapshot. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param snapshotId The identifier (ID) of a STACKIT Snapshot. + @return ApiUpdateSnapshotRequest +*/ +func (a *APIClient) UpdateSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiUpdateSnapshotRequest { + return UpdateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } +} + +func (a *APIClient) UpdateSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) { + r := UpdateSnapshotRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + snapshotId: snapshotId, + } + return r.Execute() +} + +type UpdateVolumeRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + region string + volumeId string + updateVolumePayload *UpdateVolumePayload +} + +// Request an update of a volume. + +func (r UpdateVolumeRequest) UpdateVolumePayload(updateVolumePayload UpdateVolumePayload) ApiUpdateVolumeRequest { + r.updateVolumePayload = &updateVolumePayload + return r +} + +func (r UpdateVolumeRequest) Execute() (*Volume, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Volume + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateVolume") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}/regions/{region}/volumes/{volumeId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"region"+"}", url.PathEscape(ParameterValueToString(r.region, "region")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", url.PathEscape(ParameterValueToString(r.volumeId, "volumeId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.projectId) < 36 { + return localVarReturnValue, fmt.Errorf("projectId must have at least 36 elements") + } + if strlen(r.projectId) > 36 { + return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") + } + if strlen(r.volumeId) < 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have at least 36 elements") + } + if strlen(r.volumeId) > 36 { + return localVarReturnValue, fmt.Errorf("volumeId must have less than 36 elements") + } + if r.updateVolumePayload == nil { + return localVarReturnValue, fmt.Errorf("updateVolumePayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateVolumePayload + req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +UpdateVolume: Update information of a volume. + +Update name, description or labels of the volume. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The identifier (ID) of a STACKIT Project. + @param region The STACKIT Region of the resources. + @param volumeId The identifier (ID) of a STACKIT Volume. + @return ApiUpdateVolumeRequest +*/ +func (a *APIClient) UpdateVolume(ctx context.Context, projectId string, region string, volumeId string) ApiUpdateVolumeRequest { + return UpdateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } +} + +func (a *APIClient) UpdateVolumeExecute(ctx context.Context, projectId string, region string, volumeId string) (*Volume, error) { + r := UpdateVolumeRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + region: region, + volumeId: volumeId, + } + return r.Execute() +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/client.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/client.go new file mode 100644 index 00000000..60e07267 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/client.go @@ -0,0 +1,631 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the IaaS-API API v2 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + defaultApi *DefaultApiService +} + +type service struct { + client DefaultApi +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + c.defaultApi = (*DefaultApiService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func ParameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if !IsNil(postBody) { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return fmt.Errorf("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/configuration.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/configuration.go new file mode 100644 index 00000000..b20c092e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/configuration.go @@ -0,0 +1,38 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/iaas", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://iaas.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_routes_to_routing_table_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_routes_to_routing_table_payload.go new file mode 100644 index 00000000..00592a7e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_routes_to_routing_table_payload.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AddRoutesToRoutingTablePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddRoutesToRoutingTablePayload{} + +/* + types and functions for items +*/ + +// isArray +type AddRoutesToRoutingTablePayloadGetItemsAttributeType = *[]Route +type AddRoutesToRoutingTablePayloadGetItemsArgType = []Route +type AddRoutesToRoutingTablePayloadGetItemsRetType = []Route + +func getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(arg AddRoutesToRoutingTablePayloadGetItemsAttributeType) (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutesToRoutingTablePayloadGetItemsAttributeType(arg *AddRoutesToRoutingTablePayloadGetItemsAttributeType, val AddRoutesToRoutingTablePayloadGetItemsRetType) { + *arg = &val +} + +// AddRoutesToRoutingTablePayload Object represents a request to add network routes. +type AddRoutesToRoutingTablePayload struct { + // A list of routes. + // REQUIRED + Items AddRoutesToRoutingTablePayloadGetItemsAttributeType `json:"items" required:"true"` +} + +type _AddRoutesToRoutingTablePayload AddRoutesToRoutingTablePayload + +// NewAddRoutesToRoutingTablePayload instantiates a new AddRoutesToRoutingTablePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddRoutesToRoutingTablePayload(items AddRoutesToRoutingTablePayloadGetItemsArgType) *AddRoutesToRoutingTablePayload { + this := AddRoutesToRoutingTablePayload{} + setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewAddRoutesToRoutingTablePayloadWithDefaults instantiates a new AddRoutesToRoutingTablePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddRoutesToRoutingTablePayloadWithDefaults() *AddRoutesToRoutingTablePayload { + this := AddRoutesToRoutingTablePayload{} + return &this +} + +// GetItems returns the Items field value +func (o *AddRoutesToRoutingTablePayload) GetItems() (ret AddRoutesToRoutingTablePayloadGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AddRoutesToRoutingTablePayload) GetItemsOk() (ret AddRoutesToRoutingTablePayloadGetItemsRetType, ok bool) { + return getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *AddRoutesToRoutingTablePayload) SetItems(v AddRoutesToRoutingTablePayloadGetItemsRetType) { + setAddRoutesToRoutingTablePayloadGetItemsAttributeType(&o.Items, v) +} + +func (o AddRoutesToRoutingTablePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddRoutesToRoutingTablePayloadGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableAddRoutesToRoutingTablePayload struct { + value *AddRoutesToRoutingTablePayload + isSet bool +} + +func (v NullableAddRoutesToRoutingTablePayload) Get() *AddRoutesToRoutingTablePayload { + return v.value +} + +func (v *NullableAddRoutesToRoutingTablePayload) Set(val *AddRoutesToRoutingTablePayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddRoutesToRoutingTablePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddRoutesToRoutingTablePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddRoutesToRoutingTablePayload(val *AddRoutesToRoutingTablePayload) *NullableAddRoutesToRoutingTablePayload { + return &NullableAddRoutesToRoutingTablePayload{value: val, isSet: true} +} + +func (v NullableAddRoutesToRoutingTablePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddRoutesToRoutingTablePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_routing_table_to_area_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_routing_table_to_area_payload.go new file mode 100644 index 00000000..3564d435 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_routing_table_to_area_payload.go @@ -0,0 +1,517 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the AddRoutingTableToAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddRoutingTableToAreaPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type AddRoutingTableToAreaPayloadGetCreatedAtAttributeType = *time.Time +type AddRoutingTableToAreaPayloadGetCreatedAtArgType = time.Time +type AddRoutingTableToAreaPayloadGetCreatedAtRetType = time.Time + +func getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetCreatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetCreatedAtAttributeType, val AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for default +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetDefaultAttributeType = *bool +type AddRoutingTableToAreaPayloadgetDefaultArgType = bool +type AddRoutingTableToAreaPayloadgetDefaultRetType = bool + +func getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDefaultAttributeType) (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetDefaultAttributeType(arg *AddRoutingTableToAreaPayloadgetDefaultAttributeType, val AddRoutingTableToAreaPayloadgetDefaultRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetDescriptionAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetDescriptionAttributeType) (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(arg *AddRoutingTableToAreaPayloadGetDescriptionAttributeType, val AddRoutingTableToAreaPayloadGetDescriptionRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetDescriptionArgType = string +type AddRoutingTableToAreaPayloadGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType = *bool +type AddRoutingTableToAreaPayloadgetDynamicRoutesArgType = bool +type AddRoutingTableToAreaPayloadgetDynamicRoutesRetType = bool + +func getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType, val AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetIdAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetIdAttributeType) (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetIdAttributeType(arg *AddRoutingTableToAreaPayloadGetIdAttributeType, val AddRoutingTableToAreaPayloadGetIdRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetIdArgType = string +type AddRoutingTableToAreaPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type AddRoutingTableToAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type AddRoutingTableToAreaPayloadGetLabelsArgType = map[string]interface{} +type AddRoutingTableToAreaPayloadGetLabelsRetType = map[string]interface{} + +func getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetLabelsAttributeType) (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetLabelsAttributeType(arg *AddRoutingTableToAreaPayloadGetLabelsAttributeType, val AddRoutingTableToAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type AddRoutingTableToAreaPayloadGetNameAttributeType = *string + +func getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetNameAttributeType) (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetNameAttributeType(arg *AddRoutingTableToAreaPayloadGetNameAttributeType, val AddRoutingTableToAreaPayloadGetNameRetType) { + *arg = &val +} + +type AddRoutingTableToAreaPayloadGetNameArgType = string +type AddRoutingTableToAreaPayloadGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType = *bool +type AddRoutingTableToAreaPayloadgetSystemRoutesArgType = bool +type AddRoutingTableToAreaPayloadgetSystemRoutesRetType = bool + +func getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(arg AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType) (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(arg *AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType, val AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType = *time.Time +type AddRoutingTableToAreaPayloadGetUpdatedAtArgType = time.Time +type AddRoutingTableToAreaPayloadGetUpdatedAtRetType = time.Time + +func getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(arg AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType) (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(arg *AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType, val AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + *arg = &val +} + +// AddRoutingTableToAreaPayload An object representing a routing table. +type AddRoutingTableToAreaPayload struct { + // Date-time when resource was created. + CreatedAt AddRoutingTableToAreaPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise. + Default AddRoutingTableToAreaPayloadgetDefaultAttributeType `json:"default,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description AddRoutingTableToAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // A config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes AddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Universally Unique Identifier (UUID). + Id AddRoutingTableToAreaPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels AddRoutingTableToAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name AddRoutingTableToAreaPayloadGetNameAttributeType `json:"name" required:"true"` + SystemRoutes AddRoutingTableToAreaPayloadgetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` + // Date-time when resource was last updated. + UpdatedAt AddRoutingTableToAreaPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _AddRoutingTableToAreaPayload AddRoutingTableToAreaPayload + +// NewAddRoutingTableToAreaPayload instantiates a new AddRoutingTableToAreaPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddRoutingTableToAreaPayload(name AddRoutingTableToAreaPayloadGetNameArgType) *AddRoutingTableToAreaPayload { + this := AddRoutingTableToAreaPayload{} + setAddRoutingTableToAreaPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewAddRoutingTableToAreaPayloadWithDefaults instantiates a new AddRoutingTableToAreaPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddRoutingTableToAreaPayloadWithDefaults() *AddRoutingTableToAreaPayload { + this := AddRoutingTableToAreaPayload{} + var dynamicRoutes bool = true + this.DynamicRoutes = &dynamicRoutes + var systemRoutes bool = true + this.SystemRoutes = &systemRoutes + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetCreatedAt() (res AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetCreatedAtOk() (ret AddRoutingTableToAreaPayloadGetCreatedAtRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *AddRoutingTableToAreaPayload) SetCreatedAt(v AddRoutingTableToAreaPayloadGetCreatedAtRetType) { + setAddRoutingTableToAreaPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDefault() (res AddRoutingTableToAreaPayloadgetDefaultRetType) { + res, _ = o.GetDefaultOk() + return +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDefaultOk() (ret AddRoutingTableToAreaPayloadgetDefaultRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default) +} + +// HasDefault returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDefault() bool { + _, ok := o.GetDefaultOk() + return ok +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *AddRoutingTableToAreaPayload) SetDefault(v AddRoutingTableToAreaPayloadgetDefaultRetType) { + setAddRoutingTableToAreaPayloadgetDefaultAttributeType(&o.Default, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDescription() (res AddRoutingTableToAreaPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDescriptionOk() (ret AddRoutingTableToAreaPayloadGetDescriptionRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AddRoutingTableToAreaPayload) SetDescription(v AddRoutingTableToAreaPayloadGetDescriptionRetType) { + setAddRoutingTableToAreaPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetDynamicRoutes() (res AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetDynamicRoutesOk() (ret AddRoutingTableToAreaPayloadgetDynamicRoutesRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *AddRoutingTableToAreaPayload) SetDynamicRoutes(v AddRoutingTableToAreaPayloadgetDynamicRoutesRetType) { + setAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetId() (res AddRoutingTableToAreaPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetIdOk() (ret AddRoutingTableToAreaPayloadGetIdRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AddRoutingTableToAreaPayload) SetId(v AddRoutingTableToAreaPayloadGetIdRetType) { + setAddRoutingTableToAreaPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetLabels() (res AddRoutingTableToAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetLabelsOk() (ret AddRoutingTableToAreaPayloadGetLabelsRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *AddRoutingTableToAreaPayload) SetLabels(v AddRoutingTableToAreaPayloadGetLabelsRetType) { + setAddRoutingTableToAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *AddRoutingTableToAreaPayload) GetName() (ret AddRoutingTableToAreaPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetNameOk() (ret AddRoutingTableToAreaPayloadGetNameRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *AddRoutingTableToAreaPayload) SetName(v AddRoutingTableToAreaPayloadGetNameRetType) { + setAddRoutingTableToAreaPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetSystemRoutes() (res AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetSystemRoutesOk() (ret AddRoutingTableToAreaPayloadgetSystemRoutesRetType, ok bool) { + return getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *AddRoutingTableToAreaPayload) SetSystemRoutes(v AddRoutingTableToAreaPayloadgetSystemRoutesRetType) { + setAddRoutingTableToAreaPayloadgetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *AddRoutingTableToAreaPayload) GetUpdatedAt() (res AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddRoutingTableToAreaPayload) GetUpdatedAtOk() (ret AddRoutingTableToAreaPayloadGetUpdatedAtRetType, ok bool) { + return getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *AddRoutingTableToAreaPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *AddRoutingTableToAreaPayload) SetUpdatedAt(v AddRoutingTableToAreaPayloadGetUpdatedAtRetType) { + setAddRoutingTableToAreaPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o AddRoutingTableToAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddRoutingTableToAreaPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadgetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + if val, ok := getAddRoutingTableToAreaPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableAddRoutingTableToAreaPayload struct { + value *AddRoutingTableToAreaPayload + isSet bool +} + +func (v NullableAddRoutingTableToAreaPayload) Get() *AddRoutingTableToAreaPayload { + return v.value +} + +func (v *NullableAddRoutingTableToAreaPayload) Set(val *AddRoutingTableToAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddRoutingTableToAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddRoutingTableToAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddRoutingTableToAreaPayload(val *AddRoutingTableToAreaPayload) *NullableAddRoutingTableToAreaPayload { + return &NullableAddRoutingTableToAreaPayload{value: val, isSet: true} +} + +func (v NullableAddRoutingTableToAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddRoutingTableToAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_volume_to_server_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_volume_to_server_payload.go new file mode 100644 index 00000000..bf313878 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_add_volume_to_server_payload.go @@ -0,0 +1,226 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AddVolumeToServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddVolumeToServerPayload{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType = *bool +type AddVolumeToServerPayloadgetDeleteOnTerminationArgType = bool +type AddVolumeToServerPayloadgetDeleteOnTerminationRetType = bool + +func getAddVolumeToServerPayloadgetDeleteOnTerminationAttributeTypeOk(arg AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType) (ret AddVolumeToServerPayloadgetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddVolumeToServerPayloadgetDeleteOnTerminationAttributeType(arg *AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType, val AddVolumeToServerPayloadgetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for serverId +*/ + +// isNotNullableString +type AddVolumeToServerPayloadGetServerIdAttributeType = *string + +func getAddVolumeToServerPayloadGetServerIdAttributeTypeOk(arg AddVolumeToServerPayloadGetServerIdAttributeType) (ret AddVolumeToServerPayloadGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddVolumeToServerPayloadGetServerIdAttributeType(arg *AddVolumeToServerPayloadGetServerIdAttributeType, val AddVolumeToServerPayloadGetServerIdRetType) { + *arg = &val +} + +type AddVolumeToServerPayloadGetServerIdArgType = string +type AddVolumeToServerPayloadGetServerIdRetType = string + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type AddVolumeToServerPayloadGetVolumeIdAttributeType = *string + +func getAddVolumeToServerPayloadGetVolumeIdAttributeTypeOk(arg AddVolumeToServerPayloadGetVolumeIdAttributeType) (ret AddVolumeToServerPayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAddVolumeToServerPayloadGetVolumeIdAttributeType(arg *AddVolumeToServerPayloadGetVolumeIdAttributeType, val AddVolumeToServerPayloadGetVolumeIdRetType) { + *arg = &val +} + +type AddVolumeToServerPayloadGetVolumeIdArgType = string +type AddVolumeToServerPayloadGetVolumeIdRetType = string + +// AddVolumeToServerPayload Object that represents a Volume attachment to a server. +type AddVolumeToServerPayload struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination AddVolumeToServerPayloadgetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId AddVolumeToServerPayloadGetServerIdAttributeType `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId AddVolumeToServerPayloadGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewAddVolumeToServerPayload instantiates a new AddVolumeToServerPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddVolumeToServerPayload() *AddVolumeToServerPayload { + this := AddVolumeToServerPayload{} + return &this +} + +// NewAddVolumeToServerPayloadWithDefaults instantiates a new AddVolumeToServerPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddVolumeToServerPayloadWithDefaults() *AddVolumeToServerPayload { + this := AddVolumeToServerPayload{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetDeleteOnTermination() (res AddVolumeToServerPayloadgetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetDeleteOnTerminationOk() (ret AddVolumeToServerPayloadgetDeleteOnTerminationRetType, ok bool) { + return getAddVolumeToServerPayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *AddVolumeToServerPayload) SetDeleteOnTermination(v AddVolumeToServerPayloadgetDeleteOnTerminationRetType) { + setAddVolumeToServerPayloadgetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetServerId() (res AddVolumeToServerPayloadGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetServerIdOk() (ret AddVolumeToServerPayloadGetServerIdRetType, ok bool) { + return getAddVolumeToServerPayloadGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *AddVolumeToServerPayload) SetServerId(v AddVolumeToServerPayloadGetServerIdRetType) { + setAddVolumeToServerPayloadGetServerIdAttributeType(&o.ServerId, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *AddVolumeToServerPayload) GetVolumeId() (res AddVolumeToServerPayloadGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddVolumeToServerPayload) GetVolumeIdOk() (ret AddVolumeToServerPayloadGetVolumeIdRetType, ok bool) { + return getAddVolumeToServerPayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *AddVolumeToServerPayload) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *AddVolumeToServerPayload) SetVolumeId(v AddVolumeToServerPayloadGetVolumeIdRetType) { + setAddVolumeToServerPayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o AddVolumeToServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAddVolumeToServerPayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getAddVolumeToServerPayloadGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getAddVolumeToServerPayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableAddVolumeToServerPayload struct { + value *AddVolumeToServerPayload + isSet bool +} + +func (v NullableAddVolumeToServerPayload) Get() *AddVolumeToServerPayload { + return v.value +} + +func (v *NullableAddVolumeToServerPayload) Set(val *AddVolumeToServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableAddVolumeToServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableAddVolumeToServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddVolumeToServerPayload(val *AddVolumeToServerPayload) *NullableAddVolumeToServerPayload { + return &NullableAddVolumeToServerPayload{value: val, isSet: true} +} + +func (v NullableAddVolumeToServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddVolumeToServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_affinity_group.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_affinity_group.go new file mode 100644 index 00000000..9e5dac4f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_affinity_group.go @@ -0,0 +1,269 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AffinityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AffinityGroup{} + +/* + types and functions for id +*/ + +// isNotNullableString +type AffinityGroupGetIdAttributeType = *string + +func getAffinityGroupGetIdAttributeTypeOk(arg AffinityGroupGetIdAttributeType) (ret AffinityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetIdAttributeType(arg *AffinityGroupGetIdAttributeType, val AffinityGroupGetIdRetType) { + *arg = &val +} + +type AffinityGroupGetIdArgType = string +type AffinityGroupGetIdRetType = string + +/* + types and functions for members +*/ + +// isArray +type AffinityGroupGetMembersAttributeType = *[]string +type AffinityGroupGetMembersArgType = []string +type AffinityGroupGetMembersRetType = []string + +func getAffinityGroupGetMembersAttributeTypeOk(arg AffinityGroupGetMembersAttributeType) (ret AffinityGroupGetMembersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetMembersAttributeType(arg *AffinityGroupGetMembersAttributeType, val AffinityGroupGetMembersRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type AffinityGroupGetNameAttributeType = *string + +func getAffinityGroupGetNameAttributeTypeOk(arg AffinityGroupGetNameAttributeType) (ret AffinityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetNameAttributeType(arg *AffinityGroupGetNameAttributeType, val AffinityGroupGetNameRetType) { + *arg = &val +} + +type AffinityGroupGetNameArgType = string +type AffinityGroupGetNameRetType = string + +/* + types and functions for policy +*/ + +// isNotNullableString +type AffinityGroupGetPolicyAttributeType = *string + +func getAffinityGroupGetPolicyAttributeTypeOk(arg AffinityGroupGetPolicyAttributeType) (ret AffinityGroupGetPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupGetPolicyAttributeType(arg *AffinityGroupGetPolicyAttributeType, val AffinityGroupGetPolicyRetType) { + *arg = &val +} + +type AffinityGroupGetPolicyArgType = string +type AffinityGroupGetPolicyRetType = string + +// AffinityGroup Definition of an affinity group. +type AffinityGroup struct { + // Universally Unique Identifier (UUID). + Id AffinityGroupGetIdAttributeType `json:"id,omitempty"` + // The servers that are part of the affinity group. + Members AffinityGroupGetMembersAttributeType `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name AffinityGroupGetNameAttributeType `json:"name" required:"true"` + // The affinity group policy. `hard-affinity`: All servers in this group will be hosted on the same compute node. `soft-affinity`: All servers in this group will be hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in this group will be hosted on different compute nodes. `soft-anti-affinity`: All servers in this group will be hosted on as many compute nodes as possible. Possible values: `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, `soft-affinity`. + // REQUIRED + Policy AffinityGroupGetPolicyAttributeType `json:"policy" required:"true"` +} + +type _AffinityGroup AffinityGroup + +// NewAffinityGroup instantiates a new AffinityGroup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAffinityGroup(name AffinityGroupGetNameArgType, policy AffinityGroupGetPolicyArgType) *AffinityGroup { + this := AffinityGroup{} + setAffinityGroupGetNameAttributeType(&this.Name, name) + setAffinityGroupGetPolicyAttributeType(&this.Policy, policy) + return &this +} + +// NewAffinityGroupWithDefaults instantiates a new AffinityGroup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAffinityGroupWithDefaults() *AffinityGroup { + this := AffinityGroup{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *AffinityGroup) GetId() (res AffinityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetIdOk() (ret AffinityGroupGetIdRetType, ok bool) { + return getAffinityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *AffinityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AffinityGroup) SetId(v AffinityGroupGetIdRetType) { + setAffinityGroupGetIdAttributeType(&o.Id, v) +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *AffinityGroup) GetMembers() (res AffinityGroupGetMembersRetType) { + res, _ = o.GetMembersOk() + return +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetMembersOk() (ret AffinityGroupGetMembersRetType, ok bool) { + return getAffinityGroupGetMembersAttributeTypeOk(o.Members) +} + +// HasMembers returns a boolean if a field has been set. +func (o *AffinityGroup) HasMembers() bool { + _, ok := o.GetMembersOk() + return ok +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *AffinityGroup) SetMembers(v AffinityGroupGetMembersRetType) { + setAffinityGroupGetMembersAttributeType(&o.Members, v) +} + +// GetName returns the Name field value +func (o *AffinityGroup) GetName() (ret AffinityGroupGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetNameOk() (ret AffinityGroupGetNameRetType, ok bool) { + return getAffinityGroupGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *AffinityGroup) SetName(v AffinityGroupGetNameRetType) { + setAffinityGroupGetNameAttributeType(&o.Name, v) +} + +// GetPolicy returns the Policy field value +func (o *AffinityGroup) GetPolicy() (ret AffinityGroupGetPolicyRetType) { + ret, _ = o.GetPolicyOk() + return ret +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *AffinityGroup) GetPolicyOk() (ret AffinityGroupGetPolicyRetType, ok bool) { + return getAffinityGroupGetPolicyAttributeTypeOk(o.Policy) +} + +// SetPolicy sets field value +func (o *AffinityGroup) SetPolicy(v AffinityGroupGetPolicyRetType) { + setAffinityGroupGetPolicyAttributeType(&o.Policy, v) +} + +func (o AffinityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAffinityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAffinityGroupGetMembersAttributeTypeOk(o.Members); ok { + toSerialize["Members"] = val + } + if val, ok := getAffinityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAffinityGroupGetPolicyAttributeTypeOk(o.Policy); ok { + toSerialize["Policy"] = val + } + return toSerialize, nil +} + +type NullableAffinityGroup struct { + value *AffinityGroup + isSet bool +} + +func (v NullableAffinityGroup) Get() *AffinityGroup { + return v.value +} + +func (v *NullableAffinityGroup) Set(val *AffinityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableAffinityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableAffinityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAffinityGroup(val *AffinityGroup) *NullableAffinityGroup { + return &NullableAffinityGroup{value: val, isSet: true} +} + +func (v NullableAffinityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAffinityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_affinity_group_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_affinity_group_list_response.go new file mode 100644 index 00000000..5aaa4473 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_affinity_group_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AffinityGroupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AffinityGroupListResponse{} + +/* + types and functions for items +*/ + +// isArray +type AffinityGroupListResponseGetItemsAttributeType = *[]AffinityGroup +type AffinityGroupListResponseGetItemsArgType = []AffinityGroup +type AffinityGroupListResponseGetItemsRetType = []AffinityGroup + +func getAffinityGroupListResponseGetItemsAttributeTypeOk(arg AffinityGroupListResponseGetItemsAttributeType) (ret AffinityGroupListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAffinityGroupListResponseGetItemsAttributeType(arg *AffinityGroupListResponseGetItemsAttributeType, val AffinityGroupListResponseGetItemsRetType) { + *arg = &val +} + +// AffinityGroupListResponse Response object for affinity group list request. +type AffinityGroupListResponse struct { + // A list of affinity groups. + // REQUIRED + Items AffinityGroupListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _AffinityGroupListResponse AffinityGroupListResponse + +// NewAffinityGroupListResponse instantiates a new AffinityGroupListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAffinityGroupListResponse(items AffinityGroupListResponseGetItemsArgType) *AffinityGroupListResponse { + this := AffinityGroupListResponse{} + setAffinityGroupListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewAffinityGroupListResponseWithDefaults instantiates a new AffinityGroupListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAffinityGroupListResponseWithDefaults() *AffinityGroupListResponse { + this := AffinityGroupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *AffinityGroupListResponse) GetItems() (ret AffinityGroupListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AffinityGroupListResponse) GetItemsOk() (ret AffinityGroupListResponseGetItemsRetType, ok bool) { + return getAffinityGroupListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *AffinityGroupListResponse) SetItems(v AffinityGroupListResponseGetItemsRetType) { + setAffinityGroupListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o AffinityGroupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAffinityGroupListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableAffinityGroupListResponse struct { + value *AffinityGroupListResponse + isSet bool +} + +func (v NullableAffinityGroupListResponse) Get() *AffinityGroupListResponse { + return v.value +} + +func (v *NullableAffinityGroupListResponse) Set(val *AffinityGroupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAffinityGroupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAffinityGroupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAffinityGroupListResponse(val *AffinityGroupListResponse) *NullableAffinityGroupListResponse { + return &NullableAffinityGroupListResponse{value: val, isSet: true} +} + +func (v NullableAffinityGroupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAffinityGroupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_allowed_addresses_inner.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_allowed_addresses_inner.go new file mode 100644 index 00000000..02e6f4d8 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_allowed_addresses_inner.go @@ -0,0 +1,138 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" + "regexp" +) + +// AllowedAddressesInner - struct for AllowedAddressesInner +type AllowedAddressesInner struct { + String *string +} + +// stringAsAllowedAddressesInner is a convenience function that returns string wrapped in AllowedAddressesInner +func StringAsAllowedAddressesInner(v *string) AllowedAddressesInner { + return AllowedAddressesInner{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *AllowedAddressesInner) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into String + dstAllowedAddressesInner1 := &AllowedAddressesInner{} + err = json.Unmarshal(data, &dstAllowedAddressesInner1.String) + if err == nil { + jsonstring, _ := json.Marshal(&dstAllowedAddressesInner1.String) + regex := `/((^\\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\\s*$)|(^\\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$))/` + regex = regexp.MustCompile("^\\/|\\/$").ReplaceAllString(regex, "$1") // Remove beginning slash and ending slash + regex = regexp.MustCompile("\\\\(.)").ReplaceAllString(regex, "$1") // Remove duplicate escaping char for dots + rawString := regexp.MustCompile(`^"|"$`).ReplaceAllString(*dstAllowedAddressesInner1.String, "$1") // Remove quotes + isMatched, _ := regexp.MatchString(regex, rawString) + if string(jsonstring) != "{}" && isMatched { // empty struct + dst.String = dstAllowedAddressesInner1.String + match++ + } + } + + // try to unmarshal data into String + dstAllowedAddressesInner2 := &AllowedAddressesInner{} + err = json.Unmarshal(data, &dstAllowedAddressesInner2.String) + if err == nil { + jsonstring, _ := json.Marshal(&dstAllowedAddressesInner2.String) + regex := `/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/(3[0-2]|2[0-9]|1[0-9]|[0-9]))$|^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(\/((1(1[0-9]|2[0-8]))|([0-9][0-9])|([0-9])))?$/` + regex = regexp.MustCompile("^\\/|\\/$").ReplaceAllString(regex, "$1") // Remove beginning slash and ending slash + regex = regexp.MustCompile("\\\\(.)").ReplaceAllString(regex, "$1") // Remove duplicate escaping char for dots + rawString := regexp.MustCompile(`^"|"$`).ReplaceAllString(*dstAllowedAddressesInner2.String, "$1") // Remove quotes + isMatched, _ := regexp.MatchString(regex, rawString) + if string(jsonstring) != "{}" && isMatched { // empty struct + dst.String = dstAllowedAddressesInner2.String + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(AllowedAddressesInner)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(AllowedAddressesInner)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src AllowedAddressesInner) MarshalJSON() ([]byte, error) { + if src.String != nil { + return json.Marshal(&src.String) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *AllowedAddressesInner) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableAllowedAddressesInner struct { + value *AllowedAddressesInner + isSet bool +} + +func (v NullableAllowedAddressesInner) Get() *AllowedAddressesInner { + return v.value +} + +func (v *NullableAllowedAddressesInner) Set(val *AllowedAddressesInner) { + v.value = val + v.isSet = true +} + +func (v NullableAllowedAddressesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableAllowedAddressesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAllowedAddressesInner(val *AllowedAddressesInner) *NullableAllowedAddressesInner { + return &NullableAllowedAddressesInner{value: val, isSet: true} +} + +func (v NullableAllowedAddressesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAllowedAddressesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area.go new file mode 100644 index 00000000..4c3138b6 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area.go @@ -0,0 +1,273 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the Area type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Area{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type AreaGetDefaultNameserversAttributeType = *[]string +type AreaGetDefaultNameserversArgType = []string +type AreaGetDefaultNameserversRetType = []string + +func getAreaGetDefaultNameserversAttributeTypeOk(arg AreaGetDefaultNameserversAttributeType) (ret AreaGetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaGetDefaultNameserversAttributeType(arg *AreaGetDefaultNameserversAttributeType, val AreaGetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for networkRanges +*/ + +// isArray +type AreaGetNetworkRangesAttributeType = *[]NetworkRange +type AreaGetNetworkRangesArgType = []NetworkRange +type AreaGetNetworkRangesRetType = []NetworkRange + +func getAreaGetNetworkRangesAttributeTypeOk(arg AreaGetNetworkRangesAttributeType) (ret AreaGetNetworkRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaGetNetworkRangesAttributeType(arg *AreaGetNetworkRangesAttributeType, val AreaGetNetworkRangesRetType) { + *arg = &val +} + +/* + types and functions for routes +*/ + +// isArray +type AreaGetRoutesAttributeType = *[]Route +type AreaGetRoutesArgType = []Route +type AreaGetRoutesRetType = []Route + +func getAreaGetRoutesAttributeTypeOk(arg AreaGetRoutesAttributeType) (ret AreaGetRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaGetRoutesAttributeType(arg *AreaGetRoutesAttributeType, val AreaGetRoutesRetType) { + *arg = &val +} + +/* + types and functions for transferNetwork +*/ + +// isNotNullableString +type AreaGetTransferNetworkAttributeType = *string + +func getAreaGetTransferNetworkAttributeTypeOk(arg AreaGetTransferNetworkAttributeType) (ret AreaGetTransferNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaGetTransferNetworkAttributeType(arg *AreaGetTransferNetworkAttributeType, val AreaGetTransferNetworkRetType) { + *arg = &val +} + +type AreaGetTransferNetworkArgType = string +type AreaGetTransferNetworkRetType = string + +// Area The basic properties of a network area. +type Area struct { + // A list containing DNS Servers/Nameservers for IPv4. + DefaultNameservers AreaGetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // A list of network ranges. + NetworkRanges AreaGetNetworkRangesAttributeType `json:"networkRanges,omitempty"` + // A list of routes. + Routes AreaGetRoutesAttributeType `json:"routes,omitempty"` + // Classless Inter-Domain Routing (CIDR). + TransferNetwork AreaGetTransferNetworkAttributeType `json:"transferNetwork,omitempty"` +} + +// NewArea instantiates a new Area object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewArea() *Area { + this := Area{} + return &this +} + +// NewAreaWithDefaults instantiates a new Area object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAreaWithDefaults() *Area { + this := Area{} + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *Area) GetDefaultNameservers() (res AreaGetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Area) GetDefaultNameserversOk() (ret AreaGetDefaultNameserversRetType, ok bool) { + return getAreaGetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *Area) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *Area) SetDefaultNameservers(v AreaGetDefaultNameserversRetType) { + setAreaGetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetNetworkRanges returns the NetworkRanges field value if set, zero value otherwise. +func (o *Area) GetNetworkRanges() (res AreaGetNetworkRangesRetType) { + res, _ = o.GetNetworkRangesOk() + return +} + +// GetNetworkRangesOk returns a tuple with the NetworkRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Area) GetNetworkRangesOk() (ret AreaGetNetworkRangesRetType, ok bool) { + return getAreaGetNetworkRangesAttributeTypeOk(o.NetworkRanges) +} + +// HasNetworkRanges returns a boolean if a field has been set. +func (o *Area) HasNetworkRanges() bool { + _, ok := o.GetNetworkRangesOk() + return ok +} + +// SetNetworkRanges gets a reference to the given []NetworkRange and assigns it to the NetworkRanges field. +func (o *Area) SetNetworkRanges(v AreaGetNetworkRangesRetType) { + setAreaGetNetworkRangesAttributeType(&o.NetworkRanges, v) +} + +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *Area) GetRoutes() (res AreaGetRoutesRetType) { + res, _ = o.GetRoutesOk() + return +} + +// GetRoutesOk returns a tuple with the Routes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Area) GetRoutesOk() (ret AreaGetRoutesRetType, ok bool) { + return getAreaGetRoutesAttributeTypeOk(o.Routes) +} + +// HasRoutes returns a boolean if a field has been set. +func (o *Area) HasRoutes() bool { + _, ok := o.GetRoutesOk() + return ok +} + +// SetRoutes gets a reference to the given []Route and assigns it to the Routes field. +func (o *Area) SetRoutes(v AreaGetRoutesRetType) { + setAreaGetRoutesAttributeType(&o.Routes, v) +} + +// GetTransferNetwork returns the TransferNetwork field value if set, zero value otherwise. +func (o *Area) GetTransferNetwork() (res AreaGetTransferNetworkRetType) { + res, _ = o.GetTransferNetworkOk() + return +} + +// GetTransferNetworkOk returns a tuple with the TransferNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Area) GetTransferNetworkOk() (ret AreaGetTransferNetworkRetType, ok bool) { + return getAreaGetTransferNetworkAttributeTypeOk(o.TransferNetwork) +} + +// HasTransferNetwork returns a boolean if a field has been set. +func (o *Area) HasTransferNetwork() bool { + _, ok := o.GetTransferNetworkOk() + return ok +} + +// SetTransferNetwork gets a reference to the given string and assigns it to the TransferNetwork field. +func (o *Area) SetTransferNetwork(v AreaGetTransferNetworkRetType) { + setAreaGetTransferNetworkAttributeType(&o.TransferNetwork, v) +} + +func (o Area) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAreaGetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getAreaGetNetworkRangesAttributeTypeOk(o.NetworkRanges); ok { + toSerialize["NetworkRanges"] = val + } + if val, ok := getAreaGetRoutesAttributeTypeOk(o.Routes); ok { + toSerialize["Routes"] = val + } + if val, ok := getAreaGetTransferNetworkAttributeTypeOk(o.TransferNetwork); ok { + toSerialize["TransferNetwork"] = val + } + return toSerialize, nil +} + +type NullableArea struct { + value *Area + isSet bool +} + +func (v NullableArea) Get() *Area { + return v.value +} + +func (v *NullableArea) Set(val *Area) { + v.value = val + v.isSet = true +} + +func (v NullableArea) IsSet() bool { + return v.isSet +} + +func (v *NullableArea) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableArea(val *Area) *NullableArea { + return &NullableArea{value: val, isSet: true} +} + +func (v NullableArea) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableArea) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_config.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_config.go new file mode 100644 index 00000000..ded3ed83 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_config.go @@ -0,0 +1,266 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AreaConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AreaConfig{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type AreaConfigGetDefaultNameserversAttributeType = *[]string +type AreaConfigGetDefaultNameserversArgType = []string +type AreaConfigGetDefaultNameserversRetType = []string + +func getAreaConfigGetDefaultNameserversAttributeTypeOk(arg AreaConfigGetDefaultNameserversAttributeType) (ret AreaConfigGetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaConfigGetDefaultNameserversAttributeType(arg *AreaConfigGetDefaultNameserversAttributeType, val AreaConfigGetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for networkRanges +*/ + +// isArray +type AreaConfigGetNetworkRangesAttributeType = *[]NetworkRange +type AreaConfigGetNetworkRangesArgType = []NetworkRange +type AreaConfigGetNetworkRangesRetType = []NetworkRange + +func getAreaConfigGetNetworkRangesAttributeTypeOk(arg AreaConfigGetNetworkRangesAttributeType) (ret AreaConfigGetNetworkRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaConfigGetNetworkRangesAttributeType(arg *AreaConfigGetNetworkRangesAttributeType, val AreaConfigGetNetworkRangesRetType) { + *arg = &val +} + +/* + types and functions for routes +*/ + +// isArray +type AreaConfigGetRoutesAttributeType = *[]Route +type AreaConfigGetRoutesArgType = []Route +type AreaConfigGetRoutesRetType = []Route + +func getAreaConfigGetRoutesAttributeTypeOk(arg AreaConfigGetRoutesAttributeType) (ret AreaConfigGetRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaConfigGetRoutesAttributeType(arg *AreaConfigGetRoutesAttributeType, val AreaConfigGetRoutesRetType) { + *arg = &val +} + +/* + types and functions for transferNetwork +*/ + +// isNotNullableString +type AreaConfigGetTransferNetworkAttributeType = *string + +func getAreaConfigGetTransferNetworkAttributeTypeOk(arg AreaConfigGetTransferNetworkAttributeType) (ret AreaConfigGetTransferNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaConfigGetTransferNetworkAttributeType(arg *AreaConfigGetTransferNetworkAttributeType, val AreaConfigGetTransferNetworkRetType) { + *arg = &val +} + +type AreaConfigGetTransferNetworkArgType = string +type AreaConfigGetTransferNetworkRetType = string + +// AreaConfig The basic network area object. +type AreaConfig struct { + DefaultNameservers AreaConfigGetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // A list of network ranges. + // REQUIRED + NetworkRanges AreaConfigGetNetworkRangesAttributeType `json:"networkRanges" required:"true"` + // A list of routes. + Routes AreaConfigGetRoutesAttributeType `json:"routes,omitempty"` + // Classless Inter-Domain Routing (CIDR). + // REQUIRED + TransferNetwork AreaConfigGetTransferNetworkAttributeType `json:"transferNetwork" required:"true"` +} + +type _AreaConfig AreaConfig + +// NewAreaConfig instantiates a new AreaConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAreaConfig(networkRanges AreaConfigGetNetworkRangesArgType, transferNetwork AreaConfigGetTransferNetworkArgType) *AreaConfig { + this := AreaConfig{} + setAreaConfigGetNetworkRangesAttributeType(&this.NetworkRanges, networkRanges) + setAreaConfigGetTransferNetworkAttributeType(&this.TransferNetwork, transferNetwork) + return &this +} + +// NewAreaConfigWithDefaults instantiates a new AreaConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAreaConfigWithDefaults() *AreaConfig { + this := AreaConfig{} + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *AreaConfig) GetDefaultNameservers() (res AreaConfigGetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AreaConfig) GetDefaultNameserversOk() (ret AreaConfigGetDefaultNameserversRetType, ok bool) { + return getAreaConfigGetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *AreaConfig) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *AreaConfig) SetDefaultNameservers(v AreaConfigGetDefaultNameserversRetType) { + setAreaConfigGetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetNetworkRanges returns the NetworkRanges field value +func (o *AreaConfig) GetNetworkRanges() (ret AreaConfigGetNetworkRangesRetType) { + ret, _ = o.GetNetworkRangesOk() + return ret +} + +// GetNetworkRangesOk returns a tuple with the NetworkRanges field value +// and a boolean to check if the value has been set. +func (o *AreaConfig) GetNetworkRangesOk() (ret AreaConfigGetNetworkRangesRetType, ok bool) { + return getAreaConfigGetNetworkRangesAttributeTypeOk(o.NetworkRanges) +} + +// SetNetworkRanges sets field value +func (o *AreaConfig) SetNetworkRanges(v AreaConfigGetNetworkRangesRetType) { + setAreaConfigGetNetworkRangesAttributeType(&o.NetworkRanges, v) +} + +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *AreaConfig) GetRoutes() (res AreaConfigGetRoutesRetType) { + res, _ = o.GetRoutesOk() + return +} + +// GetRoutesOk returns a tuple with the Routes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AreaConfig) GetRoutesOk() (ret AreaConfigGetRoutesRetType, ok bool) { + return getAreaConfigGetRoutesAttributeTypeOk(o.Routes) +} + +// HasRoutes returns a boolean if a field has been set. +func (o *AreaConfig) HasRoutes() bool { + _, ok := o.GetRoutesOk() + return ok +} + +// SetRoutes gets a reference to the given []Route and assigns it to the Routes field. +func (o *AreaConfig) SetRoutes(v AreaConfigGetRoutesRetType) { + setAreaConfigGetRoutesAttributeType(&o.Routes, v) +} + +// GetTransferNetwork returns the TransferNetwork field value +func (o *AreaConfig) GetTransferNetwork() (ret AreaConfigGetTransferNetworkRetType) { + ret, _ = o.GetTransferNetworkOk() + return ret +} + +// GetTransferNetworkOk returns a tuple with the TransferNetwork field value +// and a boolean to check if the value has been set. +func (o *AreaConfig) GetTransferNetworkOk() (ret AreaConfigGetTransferNetworkRetType, ok bool) { + return getAreaConfigGetTransferNetworkAttributeTypeOk(o.TransferNetwork) +} + +// SetTransferNetwork sets field value +func (o *AreaConfig) SetTransferNetwork(v AreaConfigGetTransferNetworkRetType) { + setAreaConfigGetTransferNetworkAttributeType(&o.TransferNetwork, v) +} + +func (o AreaConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAreaConfigGetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getAreaConfigGetNetworkRangesAttributeTypeOk(o.NetworkRanges); ok { + toSerialize["NetworkRanges"] = val + } + if val, ok := getAreaConfigGetRoutesAttributeTypeOk(o.Routes); ok { + toSerialize["Routes"] = val + } + if val, ok := getAreaConfigGetTransferNetworkAttributeTypeOk(o.TransferNetwork); ok { + toSerialize["TransferNetwork"] = val + } + return toSerialize, nil +} + +type NullableAreaConfig struct { + value *AreaConfig + isSet bool +} + +func (v NullableAreaConfig) Get() *AreaConfig { + return v.value +} + +func (v *NullableAreaConfig) Set(val *AreaConfig) { + v.value = val + v.isSet = true +} + +func (v NullableAreaConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableAreaConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAreaConfig(val *AreaConfig) *NullableAreaConfig { + return &NullableAreaConfig{value: val, isSet: true} +} + +func (v NullableAreaConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAreaConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_id.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_id.go new file mode 100644 index 00000000..ec835bf9 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_id.go @@ -0,0 +1,150 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" + "regexp" +) + +// AreaId - The identifier (ID) of an area. +type AreaId struct { + StaticAreaID *StaticAreaID + String *string +} + +// StaticAreaIDAsAreaId is a convenience function that returns StaticAreaID wrapped in AreaId +func StaticAreaIDAsAreaId(v *StaticAreaID) AreaId { + return AreaId{ + StaticAreaID: v, + } +} + +// stringAsAreaId is a convenience function that returns string wrapped in AreaId +func StringAsAreaId(v *string) AreaId { + return AreaId{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *AreaId) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into String + dstAreaId1 := &AreaId{} + err = json.Unmarshal(data, &dstAreaId1.String) + if err == nil { + jsonstring, _ := json.Marshal(&dstAreaId1.String) + regex := `/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/` + regex = regexp.MustCompile("^\\/|\\/$").ReplaceAllString(regex, "$1") // Remove beginning slash and ending slash + regex = regexp.MustCompile("\\\\(.)").ReplaceAllString(regex, "$1") // Remove duplicate escaping char for dots + rawString := regexp.MustCompile(`^"|"$`).ReplaceAllString(*dstAreaId1.String, "$1") // Remove quotes + isMatched, _ := regexp.MatchString(regex, rawString) + if string(jsonstring) != "{}" && isMatched { // empty struct + dst.String = dstAreaId1.String + match++ + } + } + + // try to unmarshal data into StaticAreaID + dstAreaId2 := &AreaId{} + err = json.Unmarshal(data, &dstAreaId2.StaticAreaID) + if err == nil { + jsonStaticAreaID, _ := json.Marshal(&dstAreaId2.StaticAreaID) + if string(jsonStaticAreaID) != "{}" { // empty struct + dst.StaticAreaID = dstAreaId2.StaticAreaID + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.StaticAreaID = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(AreaId)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(AreaId)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src AreaId) MarshalJSON() ([]byte, error) { + if src.StaticAreaID != nil { + return json.Marshal(&src.StaticAreaID) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *AreaId) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.StaticAreaID != nil { + return obj.StaticAreaID + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableAreaId struct { + value *AreaId + isSet bool +} + +func (v NullableAreaId) Get() *AreaId { + return v.value +} + +func (v *NullableAreaId) Set(val *AreaId) { + v.value = val + v.isSet = true +} + +func (v NullableAreaId) IsSet() bool { + return v.isSet +} + +func (v *NullableAreaId) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAreaId(val *AreaId) *NullableAreaId { + return &NullableAreaId{value: val, isSet: true} +} + +func (v NullableAreaId) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAreaId) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_prefix_config_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_prefix_config_ipv4.go new file mode 100644 index 00000000..dfe006bf --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_area_prefix_config_ipv4.go @@ -0,0 +1,230 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AreaPrefixConfigIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AreaPrefixConfigIPv4{} + +/* + types and functions for defaultPrefixLen +*/ + +// isInteger +type AreaPrefixConfigIPv4GetDefaultPrefixLenAttributeType = *int64 +type AreaPrefixConfigIPv4GetDefaultPrefixLenArgType = int64 +type AreaPrefixConfigIPv4GetDefaultPrefixLenRetType = int64 + +func getAreaPrefixConfigIPv4GetDefaultPrefixLenAttributeTypeOk(arg AreaPrefixConfigIPv4GetDefaultPrefixLenAttributeType) (ret AreaPrefixConfigIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaPrefixConfigIPv4GetDefaultPrefixLenAttributeType(arg *AreaPrefixConfigIPv4GetDefaultPrefixLenAttributeType, val AreaPrefixConfigIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isInteger +type AreaPrefixConfigIPv4GetMaxPrefixLenAttributeType = *int64 +type AreaPrefixConfigIPv4GetMaxPrefixLenArgType = int64 +type AreaPrefixConfigIPv4GetMaxPrefixLenRetType = int64 + +func getAreaPrefixConfigIPv4GetMaxPrefixLenAttributeTypeOk(arg AreaPrefixConfigIPv4GetMaxPrefixLenAttributeType) (ret AreaPrefixConfigIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaPrefixConfigIPv4GetMaxPrefixLenAttributeType(arg *AreaPrefixConfigIPv4GetMaxPrefixLenAttributeType, val AreaPrefixConfigIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isInteger +type AreaPrefixConfigIPv4GetMinPrefixLenAttributeType = *int64 +type AreaPrefixConfigIPv4GetMinPrefixLenArgType = int64 +type AreaPrefixConfigIPv4GetMinPrefixLenRetType = int64 + +func getAreaPrefixConfigIPv4GetMinPrefixLenAttributeTypeOk(arg AreaPrefixConfigIPv4GetMinPrefixLenAttributeType) (ret AreaPrefixConfigIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAreaPrefixConfigIPv4GetMinPrefixLenAttributeType(arg *AreaPrefixConfigIPv4GetMinPrefixLenAttributeType, val AreaPrefixConfigIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +// AreaPrefixConfigIPv4 The IPv4 prefix config for a network area. +type AreaPrefixConfigIPv4 struct { + // The default prefix length for networks in the network area. + DefaultPrefixLen AreaPrefixConfigIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen,omitempty"` + // The maximal prefix length for networks in the network area. + MaxPrefixLen AreaPrefixConfigIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen,omitempty"` + // The minimal prefix length for networks in the network area. + MinPrefixLen AreaPrefixConfigIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen,omitempty"` +} + +// NewAreaPrefixConfigIPv4 instantiates a new AreaPrefixConfigIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAreaPrefixConfigIPv4() *AreaPrefixConfigIPv4 { + this := AreaPrefixConfigIPv4{} + return &this +} + +// NewAreaPrefixConfigIPv4WithDefaults instantiates a new AreaPrefixConfigIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAreaPrefixConfigIPv4WithDefaults() *AreaPrefixConfigIPv4 { + this := AreaPrefixConfigIPv4{} + var defaultPrefixLen int64 = 25 + this.DefaultPrefixLen = &defaultPrefixLen + var maxPrefixLen int64 = 29 + this.MaxPrefixLen = &maxPrefixLen + var minPrefixLen int64 = 24 + this.MinPrefixLen = &minPrefixLen + return &this +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value if set, zero value otherwise. +func (o *AreaPrefixConfigIPv4) GetDefaultPrefixLen() (res AreaPrefixConfigIPv4GetDefaultPrefixLenRetType) { + res, _ = o.GetDefaultPrefixLenOk() + return +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AreaPrefixConfigIPv4) GetDefaultPrefixLenOk() (ret AreaPrefixConfigIPv4GetDefaultPrefixLenRetType, ok bool) { + return getAreaPrefixConfigIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// HasDefaultPrefixLen returns a boolean if a field has been set. +func (o *AreaPrefixConfigIPv4) HasDefaultPrefixLen() bool { + _, ok := o.GetDefaultPrefixLenOk() + return ok +} + +// SetDefaultPrefixLen gets a reference to the given int64 and assigns it to the DefaultPrefixLen field. +func (o *AreaPrefixConfigIPv4) SetDefaultPrefixLen(v AreaPrefixConfigIPv4GetDefaultPrefixLenRetType) { + setAreaPrefixConfigIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value if set, zero value otherwise. +func (o *AreaPrefixConfigIPv4) GetMaxPrefixLen() (res AreaPrefixConfigIPv4GetMaxPrefixLenRetType) { + res, _ = o.GetMaxPrefixLenOk() + return +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AreaPrefixConfigIPv4) GetMaxPrefixLenOk() (ret AreaPrefixConfigIPv4GetMaxPrefixLenRetType, ok bool) { + return getAreaPrefixConfigIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// HasMaxPrefixLen returns a boolean if a field has been set. +func (o *AreaPrefixConfigIPv4) HasMaxPrefixLen() bool { + _, ok := o.GetMaxPrefixLenOk() + return ok +} + +// SetMaxPrefixLen gets a reference to the given int64 and assigns it to the MaxPrefixLen field. +func (o *AreaPrefixConfigIPv4) SetMaxPrefixLen(v AreaPrefixConfigIPv4GetMaxPrefixLenRetType) { + setAreaPrefixConfigIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value if set, zero value otherwise. +func (o *AreaPrefixConfigIPv4) GetMinPrefixLen() (res AreaPrefixConfigIPv4GetMinPrefixLenRetType) { + res, _ = o.GetMinPrefixLenOk() + return +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AreaPrefixConfigIPv4) GetMinPrefixLenOk() (ret AreaPrefixConfigIPv4GetMinPrefixLenRetType, ok bool) { + return getAreaPrefixConfigIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// HasMinPrefixLen returns a boolean if a field has been set. +func (o *AreaPrefixConfigIPv4) HasMinPrefixLen() bool { + _, ok := o.GetMinPrefixLenOk() + return ok +} + +// SetMinPrefixLen gets a reference to the given int64 and assigns it to the MinPrefixLen field. +func (o *AreaPrefixConfigIPv4) SetMinPrefixLen(v AreaPrefixConfigIPv4GetMinPrefixLenRetType) { + setAreaPrefixConfigIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +func (o AreaPrefixConfigIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAreaPrefixConfigIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getAreaPrefixConfigIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getAreaPrefixConfigIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + return toSerialize, nil +} + +type NullableAreaPrefixConfigIPv4 struct { + value *AreaPrefixConfigIPv4 + isSet bool +} + +func (v NullableAreaPrefixConfigIPv4) Get() *AreaPrefixConfigIPv4 { + return v.value +} + +func (v *NullableAreaPrefixConfigIPv4) Set(val *AreaPrefixConfigIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableAreaPrefixConfigIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableAreaPrefixConfigIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAreaPrefixConfigIPv4(val *AreaPrefixConfigIPv4) *NullableAreaPrefixConfigIPv4 { + return &NullableAreaPrefixConfigIPv4{value: val, isSet: true} +} + +func (v NullableAreaPrefixConfigIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAreaPrefixConfigIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_availability_zone_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_availability_zone_list_response.go new file mode 100644 index 00000000..34146090 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_availability_zone_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the AvailabilityZoneListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AvailabilityZoneListResponse{} + +/* + types and functions for items +*/ + +// isArray +type AvailabilityZoneListResponseGetItemsAttributeType = *[]string +type AvailabilityZoneListResponseGetItemsArgType = []string +type AvailabilityZoneListResponseGetItemsRetType = []string + +func getAvailabilityZoneListResponseGetItemsAttributeTypeOk(arg AvailabilityZoneListResponseGetItemsAttributeType) (ret AvailabilityZoneListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAvailabilityZoneListResponseGetItemsAttributeType(arg *AvailabilityZoneListResponseGetItemsAttributeType, val AvailabilityZoneListResponseGetItemsRetType) { + *arg = &val +} + +// AvailabilityZoneListResponse Availability Zone list response. +type AvailabilityZoneListResponse struct { + // A list of availability zones. + // REQUIRED + Items AvailabilityZoneListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _AvailabilityZoneListResponse AvailabilityZoneListResponse + +// NewAvailabilityZoneListResponse instantiates a new AvailabilityZoneListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAvailabilityZoneListResponse(items AvailabilityZoneListResponseGetItemsArgType) *AvailabilityZoneListResponse { + this := AvailabilityZoneListResponse{} + setAvailabilityZoneListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewAvailabilityZoneListResponseWithDefaults instantiates a new AvailabilityZoneListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAvailabilityZoneListResponseWithDefaults() *AvailabilityZoneListResponse { + this := AvailabilityZoneListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *AvailabilityZoneListResponse) GetItems() (ret AvailabilityZoneListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *AvailabilityZoneListResponse) GetItemsOk() (ret AvailabilityZoneListResponseGetItemsRetType, ok bool) { + return getAvailabilityZoneListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *AvailabilityZoneListResponse) SetItems(v AvailabilityZoneListResponseGetItemsRetType) { + setAvailabilityZoneListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o AvailabilityZoneListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAvailabilityZoneListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableAvailabilityZoneListResponse struct { + value *AvailabilityZoneListResponse + isSet bool +} + +func (v NullableAvailabilityZoneListResponse) Get() *AvailabilityZoneListResponse { + return v.value +} + +func (v *NullableAvailabilityZoneListResponse) Set(val *AvailabilityZoneListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAvailabilityZoneListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAvailabilityZoneListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAvailabilityZoneListResponse(val *AvailabilityZoneListResponse) *NullableAvailabilityZoneListResponse { + return &NullableAvailabilityZoneListResponse{value: val, isSet: true} +} + +func (v NullableAvailabilityZoneListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAvailabilityZoneListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup.go new file mode 100644 index 00000000..ad9bd713 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup.go @@ -0,0 +1,567 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Backup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Backup{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type BackupGetAvailabilityZoneAttributeType = *string + +func getBackupGetAvailabilityZoneAttributeTypeOk(arg BackupGetAvailabilityZoneAttributeType) (ret BackupGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetAvailabilityZoneAttributeType(arg *BackupGetAvailabilityZoneAttributeType, val BackupGetAvailabilityZoneRetType) { + *arg = &val +} + +type BackupGetAvailabilityZoneArgType = string +type BackupGetAvailabilityZoneRetType = string + +/* + types and functions for createdAt +*/ + +// isDateTime +type BackupGetCreatedAtAttributeType = *time.Time +type BackupGetCreatedAtArgType = time.Time +type BackupGetCreatedAtRetType = time.Time + +func getBackupGetCreatedAtAttributeTypeOk(arg BackupGetCreatedAtAttributeType) (ret BackupGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetCreatedAtAttributeType(arg *BackupGetCreatedAtAttributeType, val BackupGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type BackupGetIdAttributeType = *string + +func getBackupGetIdAttributeTypeOk(arg BackupGetIdAttributeType) (ret BackupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetIdAttributeType(arg *BackupGetIdAttributeType, val BackupGetIdRetType) { + *arg = &val +} + +type BackupGetIdArgType = string +type BackupGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type BackupGetLabelsAttributeType = *map[string]interface{} +type BackupGetLabelsArgType = map[string]interface{} +type BackupGetLabelsRetType = map[string]interface{} + +func getBackupGetLabelsAttributeTypeOk(arg BackupGetLabelsAttributeType) (ret BackupGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetLabelsAttributeType(arg *BackupGetLabelsAttributeType, val BackupGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type BackupGetNameAttributeType = *string + +func getBackupGetNameAttributeTypeOk(arg BackupGetNameAttributeType) (ret BackupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetNameAttributeType(arg *BackupGetNameAttributeType, val BackupGetNameRetType) { + *arg = &val +} + +type BackupGetNameArgType = string +type BackupGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type BackupGetSizeAttributeType = *int64 +type BackupGetSizeArgType = int64 +type BackupGetSizeRetType = int64 + +func getBackupGetSizeAttributeTypeOk(arg BackupGetSizeAttributeType) (ret BackupGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetSizeAttributeType(arg *BackupGetSizeAttributeType, val BackupGetSizeRetType) { + *arg = &val +} + +/* + types and functions for snapshotId +*/ + +// isNotNullableString +type BackupGetSnapshotIdAttributeType = *string + +func getBackupGetSnapshotIdAttributeTypeOk(arg BackupGetSnapshotIdAttributeType) (ret BackupGetSnapshotIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetSnapshotIdAttributeType(arg *BackupGetSnapshotIdAttributeType, val BackupGetSnapshotIdRetType) { + *arg = &val +} + +type BackupGetSnapshotIdArgType = string +type BackupGetSnapshotIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type BackupGetStatusAttributeType = *string + +func getBackupGetStatusAttributeTypeOk(arg BackupGetStatusAttributeType) (ret BackupGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetStatusAttributeType(arg *BackupGetStatusAttributeType, val BackupGetStatusRetType) { + *arg = &val +} + +type BackupGetStatusArgType = string +type BackupGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type BackupGetUpdatedAtAttributeType = *time.Time +type BackupGetUpdatedAtArgType = time.Time +type BackupGetUpdatedAtRetType = time.Time + +func getBackupGetUpdatedAtAttributeTypeOk(arg BackupGetUpdatedAtAttributeType) (ret BackupGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetUpdatedAtAttributeType(arg *BackupGetUpdatedAtAttributeType, val BackupGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type BackupGetVolumeIdAttributeType = *string + +func getBackupGetVolumeIdAttributeTypeOk(arg BackupGetVolumeIdAttributeType) (ret BackupGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupGetVolumeIdAttributeType(arg *BackupGetVolumeIdAttributeType, val BackupGetVolumeIdRetType) { + *arg = &val +} + +type BackupGetVolumeIdArgType = string +type BackupGetVolumeIdRetType = string + +// Backup Object that represents a backup. +type Backup struct { + // Object that represents an availability zone. + AvailabilityZone BackupGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Date-time when resource was created. + CreatedAt BackupGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id BackupGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels BackupGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name BackupGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size BackupGetSizeAttributeType `json:"size,omitempty"` + // Universally Unique Identifier (UUID). + SnapshotId BackupGetSnapshotIdAttributeType `json:"snapshotId,omitempty"` + // The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + Status BackupGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt BackupGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId BackupGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewBackup instantiates a new Backup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBackup() *Backup { + this := Backup{} + return &this +} + +// NewBackupWithDefaults instantiates a new Backup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBackupWithDefaults() *Backup { + this := Backup{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *Backup) GetAvailabilityZone() (res BackupGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetAvailabilityZoneOk() (ret BackupGetAvailabilityZoneRetType, ok bool) { + return getBackupGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *Backup) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *Backup) SetAvailabilityZone(v BackupGetAvailabilityZoneRetType) { + setBackupGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Backup) GetCreatedAt() (res BackupGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetCreatedAtOk() (ret BackupGetCreatedAtRetType, ok bool) { + return getBackupGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Backup) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Backup) SetCreatedAt(v BackupGetCreatedAtRetType) { + setBackupGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Backup) GetId() (res BackupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetIdOk() (ret BackupGetIdRetType, ok bool) { + return getBackupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Backup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Backup) SetId(v BackupGetIdRetType) { + setBackupGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Backup) GetLabels() (res BackupGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetLabelsOk() (ret BackupGetLabelsRetType, ok bool) { + return getBackupGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Backup) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Backup) SetLabels(v BackupGetLabelsRetType) { + setBackupGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Backup) GetName() (res BackupGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetNameOk() (ret BackupGetNameRetType, ok bool) { + return getBackupGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Backup) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Backup) SetName(v BackupGetNameRetType) { + setBackupGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Backup) GetSize() (res BackupGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetSizeOk() (ret BackupGetSizeRetType, ok bool) { + return getBackupGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Backup) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Backup) SetSize(v BackupGetSizeRetType) { + setBackupGetSizeAttributeType(&o.Size, v) +} + +// GetSnapshotId returns the SnapshotId field value if set, zero value otherwise. +func (o *Backup) GetSnapshotId() (res BackupGetSnapshotIdRetType) { + res, _ = o.GetSnapshotIdOk() + return +} + +// GetSnapshotIdOk returns a tuple with the SnapshotId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetSnapshotIdOk() (ret BackupGetSnapshotIdRetType, ok bool) { + return getBackupGetSnapshotIdAttributeTypeOk(o.SnapshotId) +} + +// HasSnapshotId returns a boolean if a field has been set. +func (o *Backup) HasSnapshotId() bool { + _, ok := o.GetSnapshotIdOk() + return ok +} + +// SetSnapshotId gets a reference to the given string and assigns it to the SnapshotId field. +func (o *Backup) SetSnapshotId(v BackupGetSnapshotIdRetType) { + setBackupGetSnapshotIdAttributeType(&o.SnapshotId, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Backup) GetStatus() (res BackupGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetStatusOk() (ret BackupGetStatusRetType, ok bool) { + return getBackupGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Backup) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Backup) SetStatus(v BackupGetStatusRetType) { + setBackupGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Backup) GetUpdatedAt() (res BackupGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetUpdatedAtOk() (ret BackupGetUpdatedAtRetType, ok bool) { + return getBackupGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Backup) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Backup) SetUpdatedAt(v BackupGetUpdatedAtRetType) { + setBackupGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *Backup) GetVolumeId() (res BackupGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Backup) GetVolumeIdOk() (ret BackupGetVolumeIdRetType, ok bool) { + return getBackupGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *Backup) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *Backup) SetVolumeId(v BackupGetVolumeIdRetType) { + setBackupGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o Backup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBackupGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getBackupGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getBackupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBackupGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getBackupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getBackupGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getBackupGetSnapshotIdAttributeTypeOk(o.SnapshotId); ok { + toSerialize["SnapshotId"] = val + } + if val, ok := getBackupGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getBackupGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getBackupGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableBackup struct { + value *Backup + isSet bool +} + +func (v NullableBackup) Get() *Backup { + return v.value +} + +func (v *NullableBackup) Set(val *Backup) { + v.value = val + v.isSet = true +} + +func (v NullableBackup) IsSet() bool { + return v.isSet +} + +func (v *NullableBackup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackup(val *Backup) *NullableBackup { + return &NullableBackup{value: val, isSet: true} +} + +func (v NullableBackup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup_list_response.go new file mode 100644 index 00000000..8181daa1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BackupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupListResponse{} + +/* + types and functions for items +*/ + +// isArray +type BackupListResponseGetItemsAttributeType = *[]Backup +type BackupListResponseGetItemsArgType = []Backup +type BackupListResponseGetItemsRetType = []Backup + +func getBackupListResponseGetItemsAttributeTypeOk(arg BackupListResponseGetItemsAttributeType) (ret BackupListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupListResponseGetItemsAttributeType(arg *BackupListResponseGetItemsAttributeType, val BackupListResponseGetItemsRetType) { + *arg = &val +} + +// BackupListResponse Backup list response. +type BackupListResponse struct { + // A list containing backup objects. + // REQUIRED + Items BackupListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _BackupListResponse BackupListResponse + +// NewBackupListResponse instantiates a new BackupListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBackupListResponse(items BackupListResponseGetItemsArgType) *BackupListResponse { + this := BackupListResponse{} + setBackupListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewBackupListResponseWithDefaults instantiates a new BackupListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBackupListResponseWithDefaults() *BackupListResponse { + this := BackupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *BackupListResponse) GetItems() (ret BackupListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *BackupListResponse) GetItemsOk() (ret BackupListResponseGetItemsRetType, ok bool) { + return getBackupListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *BackupListResponse) SetItems(v BackupListResponseGetItemsRetType) { + setBackupListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o BackupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBackupListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableBackupListResponse struct { + value *BackupListResponse + isSet bool +} + +func (v NullableBackupListResponse) Get() *BackupListResponse { + return v.value +} + +func (v *NullableBackupListResponse) Set(val *BackupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBackupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupListResponse(val *BackupListResponse) *NullableBackupListResponse { + return &NullableBackupListResponse{value: val, isSet: true} +} + +func (v NullableBackupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup_source.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup_source.go new file mode 100644 index 00000000..f4092993 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_backup_source.go @@ -0,0 +1,172 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BackupSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupSource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type BackupSourceGetIdAttributeType = *string + +func getBackupSourceGetIdAttributeTypeOk(arg BackupSourceGetIdAttributeType) (ret BackupSourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupSourceGetIdAttributeType(arg *BackupSourceGetIdAttributeType, val BackupSourceGetIdRetType) { + *arg = &val +} + +type BackupSourceGetIdArgType = string +type BackupSourceGetIdRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type BackupSourceGetTypeAttributeType = *string + +func getBackupSourceGetTypeAttributeTypeOk(arg BackupSourceGetTypeAttributeType) (ret BackupSourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBackupSourceGetTypeAttributeType(arg *BackupSourceGetTypeAttributeType, val BackupSourceGetTypeRetType) { + *arg = &val +} + +type BackupSourceGetTypeArgType = string +type BackupSourceGetTypeRetType = string + +// BackupSource The source object of a backup. +type BackupSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id BackupSourceGetIdAttributeType `json:"id" required:"true"` + // The source types of a backup. Possible values: `volume`, `snapshot`. + // REQUIRED + Type BackupSourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _BackupSource BackupSource + +// NewBackupSource instantiates a new BackupSource object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBackupSource(id BackupSourceGetIdArgType, types BackupSourceGetTypeArgType) *BackupSource { + this := BackupSource{} + setBackupSourceGetIdAttributeType(&this.Id, id) + setBackupSourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewBackupSourceWithDefaults instantiates a new BackupSource object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBackupSourceWithDefaults() *BackupSource { + this := BackupSource{} + return &this +} + +// GetId returns the Id field value +func (o *BackupSource) GetId() (ret BackupSourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *BackupSource) GetIdOk() (ret BackupSourceGetIdRetType, ok bool) { + return getBackupSourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *BackupSource) SetId(v BackupSourceGetIdRetType) { + setBackupSourceGetIdAttributeType(&o.Id, v) +} + +// GetType returns the Type field value +func (o *BackupSource) GetType() (ret BackupSourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BackupSource) GetTypeOk() (ret BackupSourceGetTypeRetType, ok bool) { + return getBackupSourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *BackupSource) SetType(v BackupSourceGetTypeRetType) { + setBackupSourceGetTypeAttributeType(&o.Type, v) +} + +func (o BackupSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBackupSourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBackupSourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableBackupSource struct { + value *BackupSource + isSet bool +} + +func (v NullableBackupSource) Get() *BackupSource { + return v.value +} + +func (v *NullableBackupSource) Set(val *BackupSource) { + v.value = val + v.isSet = true +} + +func (v NullableBackupSource) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupSource(val *BackupSource) *NullableBackupSource { + return &NullableBackupSource{value: val, isSet: true} +} + +func (v NullableBackupSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_base_security_group_rule.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_base_security_group_rule.go new file mode 100644 index 00000000..fa3eb56f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_base_security_group_rule.go @@ -0,0 +1,614 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the BaseSecurityGroupRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BaseSecurityGroupRule{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type BaseSecurityGroupRuleGetCreatedAtAttributeType = *time.Time +type BaseSecurityGroupRuleGetCreatedAtArgType = time.Time +type BaseSecurityGroupRuleGetCreatedAtRetType = time.Time + +func getBaseSecurityGroupRuleGetCreatedAtAttributeTypeOk(arg BaseSecurityGroupRuleGetCreatedAtAttributeType) (ret BaseSecurityGroupRuleGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetCreatedAtAttributeType(arg *BaseSecurityGroupRuleGetCreatedAtAttributeType, val BaseSecurityGroupRuleGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetDescriptionAttributeType = *string + +func getBaseSecurityGroupRuleGetDescriptionAttributeTypeOk(arg BaseSecurityGroupRuleGetDescriptionAttributeType) (ret BaseSecurityGroupRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetDescriptionAttributeType(arg *BaseSecurityGroupRuleGetDescriptionAttributeType, val BaseSecurityGroupRuleGetDescriptionRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetDescriptionArgType = string +type BaseSecurityGroupRuleGetDescriptionRetType = string + +/* + types and functions for direction +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetDirectionAttributeType = *string + +func getBaseSecurityGroupRuleGetDirectionAttributeTypeOk(arg BaseSecurityGroupRuleGetDirectionAttributeType) (ret BaseSecurityGroupRuleGetDirectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetDirectionAttributeType(arg *BaseSecurityGroupRuleGetDirectionAttributeType, val BaseSecurityGroupRuleGetDirectionRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetDirectionArgType = string +type BaseSecurityGroupRuleGetDirectionRetType = string + +/* + types and functions for ethertype +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetEthertypeAttributeType = *string + +func getBaseSecurityGroupRuleGetEthertypeAttributeTypeOk(arg BaseSecurityGroupRuleGetEthertypeAttributeType) (ret BaseSecurityGroupRuleGetEthertypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetEthertypeAttributeType(arg *BaseSecurityGroupRuleGetEthertypeAttributeType, val BaseSecurityGroupRuleGetEthertypeRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetEthertypeArgType = string +type BaseSecurityGroupRuleGetEthertypeRetType = string + +/* + types and functions for icmpParameters +*/ + +// isModel +type BaseSecurityGroupRuleGetIcmpParametersAttributeType = *ICMPParameters +type BaseSecurityGroupRuleGetIcmpParametersArgType = ICMPParameters +type BaseSecurityGroupRuleGetIcmpParametersRetType = ICMPParameters + +func getBaseSecurityGroupRuleGetIcmpParametersAttributeTypeOk(arg BaseSecurityGroupRuleGetIcmpParametersAttributeType) (ret BaseSecurityGroupRuleGetIcmpParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetIcmpParametersAttributeType(arg *BaseSecurityGroupRuleGetIcmpParametersAttributeType, val BaseSecurityGroupRuleGetIcmpParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetIdAttributeType = *string + +func getBaseSecurityGroupRuleGetIdAttributeTypeOk(arg BaseSecurityGroupRuleGetIdAttributeType) (ret BaseSecurityGroupRuleGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetIdAttributeType(arg *BaseSecurityGroupRuleGetIdAttributeType, val BaseSecurityGroupRuleGetIdRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetIdArgType = string +type BaseSecurityGroupRuleGetIdRetType = string + +/* + types and functions for ipRange +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetIpRangeAttributeType = *string + +func getBaseSecurityGroupRuleGetIpRangeAttributeTypeOk(arg BaseSecurityGroupRuleGetIpRangeAttributeType) (ret BaseSecurityGroupRuleGetIpRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetIpRangeAttributeType(arg *BaseSecurityGroupRuleGetIpRangeAttributeType, val BaseSecurityGroupRuleGetIpRangeRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetIpRangeArgType = string +type BaseSecurityGroupRuleGetIpRangeRetType = string + +/* + types and functions for portRange +*/ + +// isModel +type BaseSecurityGroupRuleGetPortRangeAttributeType = *PortRange +type BaseSecurityGroupRuleGetPortRangeArgType = PortRange +type BaseSecurityGroupRuleGetPortRangeRetType = PortRange + +func getBaseSecurityGroupRuleGetPortRangeAttributeTypeOk(arg BaseSecurityGroupRuleGetPortRangeAttributeType) (ret BaseSecurityGroupRuleGetPortRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetPortRangeAttributeType(arg *BaseSecurityGroupRuleGetPortRangeAttributeType, val BaseSecurityGroupRuleGetPortRangeRetType) { + *arg = &val +} + +/* + types and functions for remoteSecurityGroupId +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType = *string + +func getBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(arg BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType) (ret BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(arg *BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType, val BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetRemoteSecurityGroupIdArgType = string +type BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType = string + +/* + types and functions for securityGroupId +*/ + +// isNotNullableString +type BaseSecurityGroupRuleGetSecurityGroupIdAttributeType = *string + +func getBaseSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(arg BaseSecurityGroupRuleGetSecurityGroupIdAttributeType) (ret BaseSecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetSecurityGroupIdAttributeType(arg *BaseSecurityGroupRuleGetSecurityGroupIdAttributeType, val BaseSecurityGroupRuleGetSecurityGroupIdRetType) { + *arg = &val +} + +type BaseSecurityGroupRuleGetSecurityGroupIdArgType = string +type BaseSecurityGroupRuleGetSecurityGroupIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type BaseSecurityGroupRuleGetUpdatedAtAttributeType = *time.Time +type BaseSecurityGroupRuleGetUpdatedAtArgType = time.Time +type BaseSecurityGroupRuleGetUpdatedAtRetType = time.Time + +func getBaseSecurityGroupRuleGetUpdatedAtAttributeTypeOk(arg BaseSecurityGroupRuleGetUpdatedAtAttributeType) (ret BaseSecurityGroupRuleGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBaseSecurityGroupRuleGetUpdatedAtAttributeType(arg *BaseSecurityGroupRuleGetUpdatedAtAttributeType, val BaseSecurityGroupRuleGetUpdatedAtRetType) { + *arg = &val +} + +// BaseSecurityGroupRule The base schema for a security group rule. +type BaseSecurityGroupRule struct { + // Date-time when resource was created. + CreatedAt BaseSecurityGroupRuleGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description BaseSecurityGroupRuleGetDescriptionAttributeType `json:"description,omitempty"` + // The direction of the traffic which the rule should match. Possible values: `ingress`, `egress`. + // REQUIRED + Direction BaseSecurityGroupRuleGetDirectionAttributeType `json:"direction" required:"true"` + // The ethertype which the rule should match. Possible values: `IPv4`, `IPv6`. + Ethertype BaseSecurityGroupRuleGetEthertypeAttributeType `json:"ethertype,omitempty"` + IcmpParameters BaseSecurityGroupRuleGetIcmpParametersAttributeType `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id BaseSecurityGroupRuleGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange BaseSecurityGroupRuleGetIpRangeAttributeType `json:"ipRange,omitempty"` + PortRange BaseSecurityGroupRuleGetPortRangeAttributeType `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId BaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId BaseSecurityGroupRuleGetSecurityGroupIdAttributeType `json:"securityGroupId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt BaseSecurityGroupRuleGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _BaseSecurityGroupRule BaseSecurityGroupRule + +// NewBaseSecurityGroupRule instantiates a new BaseSecurityGroupRule object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBaseSecurityGroupRule(direction BaseSecurityGroupRuleGetDirectionArgType) *BaseSecurityGroupRule { + this := BaseSecurityGroupRule{} + setBaseSecurityGroupRuleGetDirectionAttributeType(&this.Direction, direction) + return &this +} + +// NewBaseSecurityGroupRuleWithDefaults instantiates a new BaseSecurityGroupRule object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBaseSecurityGroupRuleWithDefaults() *BaseSecurityGroupRule { + this := BaseSecurityGroupRule{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetCreatedAt() (res BaseSecurityGroupRuleGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetCreatedAtOk() (ret BaseSecurityGroupRuleGetCreatedAtRetType, ok bool) { + return getBaseSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *BaseSecurityGroupRule) SetCreatedAt(v BaseSecurityGroupRuleGetCreatedAtRetType) { + setBaseSecurityGroupRuleGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetDescription() (res BaseSecurityGroupRuleGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetDescriptionOk() (ret BaseSecurityGroupRuleGetDescriptionRetType, ok bool) { + return getBaseSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *BaseSecurityGroupRule) SetDescription(v BaseSecurityGroupRuleGetDescriptionRetType) { + setBaseSecurityGroupRuleGetDescriptionAttributeType(&o.Description, v) +} + +// GetDirection returns the Direction field value +func (o *BaseSecurityGroupRule) GetDirection() (ret BaseSecurityGroupRuleGetDirectionRetType) { + ret, _ = o.GetDirectionOk() + return ret +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetDirectionOk() (ret BaseSecurityGroupRuleGetDirectionRetType, ok bool) { + return getBaseSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction) +} + +// SetDirection sets field value +func (o *BaseSecurityGroupRule) SetDirection(v BaseSecurityGroupRuleGetDirectionRetType) { + setBaseSecurityGroupRuleGetDirectionAttributeType(&o.Direction, v) +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetEthertype() (res BaseSecurityGroupRuleGetEthertypeRetType) { + res, _ = o.GetEthertypeOk() + return +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetEthertypeOk() (ret BaseSecurityGroupRuleGetEthertypeRetType, ok bool) { + return getBaseSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype) +} + +// HasEthertype returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasEthertype() bool { + _, ok := o.GetEthertypeOk() + return ok +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *BaseSecurityGroupRule) SetEthertype(v BaseSecurityGroupRuleGetEthertypeRetType) { + setBaseSecurityGroupRuleGetEthertypeAttributeType(&o.Ethertype, v) +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetIcmpParameters() (res BaseSecurityGroupRuleGetIcmpParametersRetType) { + res, _ = o.GetIcmpParametersOk() + return +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIcmpParametersOk() (ret BaseSecurityGroupRuleGetIcmpParametersRetType, ok bool) { + return getBaseSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters) +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasIcmpParameters() bool { + _, ok := o.GetIcmpParametersOk() + return ok +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *BaseSecurityGroupRule) SetIcmpParameters(v BaseSecurityGroupRuleGetIcmpParametersRetType) { + setBaseSecurityGroupRuleGetIcmpParametersAttributeType(&o.IcmpParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetId() (res BaseSecurityGroupRuleGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIdOk() (ret BaseSecurityGroupRuleGetIdRetType, ok bool) { + return getBaseSecurityGroupRuleGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BaseSecurityGroupRule) SetId(v BaseSecurityGroupRuleGetIdRetType) { + setBaseSecurityGroupRuleGetIdAttributeType(&o.Id, v) +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetIpRange() (res BaseSecurityGroupRuleGetIpRangeRetType) { + res, _ = o.GetIpRangeOk() + return +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetIpRangeOk() (ret BaseSecurityGroupRuleGetIpRangeRetType, ok bool) { + return getBaseSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange) +} + +// HasIpRange returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasIpRange() bool { + _, ok := o.GetIpRangeOk() + return ok +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *BaseSecurityGroupRule) SetIpRange(v BaseSecurityGroupRuleGetIpRangeRetType) { + setBaseSecurityGroupRuleGetIpRangeAttributeType(&o.IpRange, v) +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetPortRange() (res BaseSecurityGroupRuleGetPortRangeRetType) { + res, _ = o.GetPortRangeOk() + return +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetPortRangeOk() (ret BaseSecurityGroupRuleGetPortRangeRetType, ok bool) { + return getBaseSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange) +} + +// HasPortRange returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasPortRange() bool { + _, ok := o.GetPortRangeOk() + return ok +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *BaseSecurityGroupRule) SetPortRange(v BaseSecurityGroupRuleGetPortRangeRetType) { + setBaseSecurityGroupRuleGetPortRangeAttributeType(&o.PortRange, v) +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetRemoteSecurityGroupId() (res BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + res, _ = o.GetRemoteSecurityGroupIdOk() + return +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetRemoteSecurityGroupIdOk() (ret BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + return getBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId) +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasRemoteSecurityGroupId() bool { + _, ok := o.GetRemoteSecurityGroupIdOk() + return ok +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *BaseSecurityGroupRule) SetRemoteSecurityGroupId(v BaseSecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + setBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(&o.RemoteSecurityGroupId, v) +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetSecurityGroupId() (res BaseSecurityGroupRuleGetSecurityGroupIdRetType) { + res, _ = o.GetSecurityGroupIdOk() + return +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetSecurityGroupIdOk() (ret BaseSecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + return getBaseSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId) +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasSecurityGroupId() bool { + _, ok := o.GetSecurityGroupIdOk() + return ok +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *BaseSecurityGroupRule) SetSecurityGroupId(v BaseSecurityGroupRuleGetSecurityGroupIdRetType) { + setBaseSecurityGroupRuleGetSecurityGroupIdAttributeType(&o.SecurityGroupId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *BaseSecurityGroupRule) GetUpdatedAt() (res BaseSecurityGroupRuleGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BaseSecurityGroupRule) GetUpdatedAtOk() (ret BaseSecurityGroupRuleGetUpdatedAtRetType, ok bool) { + return getBaseSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *BaseSecurityGroupRule) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *BaseSecurityGroupRule) SetUpdatedAt(v BaseSecurityGroupRuleGetUpdatedAtRetType) { + setBaseSecurityGroupRuleGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o BaseSecurityGroupRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBaseSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getBaseSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getBaseSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction); ok { + toSerialize["Direction"] = val + } + if val, ok := getBaseSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype); ok { + toSerialize["Ethertype"] = val + } + if val, ok := getBaseSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters); ok { + toSerialize["IcmpParameters"] = val + } + if val, ok := getBaseSecurityGroupRuleGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBaseSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange); ok { + toSerialize["IpRange"] = val + } + if val, ok := getBaseSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange); ok { + toSerialize["PortRange"] = val + } + if val, ok := getBaseSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId); ok { + toSerialize["RemoteSecurityGroupId"] = val + } + if val, ok := getBaseSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId); ok { + toSerialize["SecurityGroupId"] = val + } + if val, ok := getBaseSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableBaseSecurityGroupRule struct { + value *BaseSecurityGroupRule + isSet bool +} + +func (v NullableBaseSecurityGroupRule) Get() *BaseSecurityGroupRule { + return v.value +} + +func (v *NullableBaseSecurityGroupRule) Set(val *BaseSecurityGroupRule) { + v.value = val + v.isSet = true +} + +func (v NullableBaseSecurityGroupRule) IsSet() bool { + return v.isSet +} + +func (v *NullableBaseSecurityGroupRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBaseSecurityGroupRule(val *BaseSecurityGroupRule) *NullableBaseSecurityGroupRule { + return &NullableBaseSecurityGroupRule{value: val, isSet: true} +} + +func (v NullableBaseSecurityGroupRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBaseSecurityGroupRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_boot_volume.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_boot_volume.go new file mode 100644 index 00000000..6f075ac0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_boot_volume.go @@ -0,0 +1,321 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BootVolume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BootVolume{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type BootVolumegetDeleteOnTerminationAttributeType = *bool +type BootVolumegetDeleteOnTerminationArgType = bool +type BootVolumegetDeleteOnTerminationRetType = bool + +func getBootVolumegetDeleteOnTerminationAttributeTypeOk(arg BootVolumegetDeleteOnTerminationAttributeType) (ret BootVolumegetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumegetDeleteOnTerminationAttributeType(arg *BootVolumegetDeleteOnTerminationAttributeType, val BootVolumegetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type BootVolumeGetIdAttributeType = *string + +func getBootVolumeGetIdAttributeTypeOk(arg BootVolumeGetIdAttributeType) (ret BootVolumeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetIdAttributeType(arg *BootVolumeGetIdAttributeType, val BootVolumeGetIdRetType) { + *arg = &val +} + +type BootVolumeGetIdArgType = string +type BootVolumeGetIdRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type BootVolumeGetPerformanceClassAttributeType = *string + +func getBootVolumeGetPerformanceClassAttributeTypeOk(arg BootVolumeGetPerformanceClassAttributeType) (ret BootVolumeGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetPerformanceClassAttributeType(arg *BootVolumeGetPerformanceClassAttributeType, val BootVolumeGetPerformanceClassRetType) { + *arg = &val +} + +type BootVolumeGetPerformanceClassArgType = string +type BootVolumeGetPerformanceClassRetType = string + +/* + types and functions for size +*/ + +// isLong +type BootVolumeGetSizeAttributeType = *int64 +type BootVolumeGetSizeArgType = int64 +type BootVolumeGetSizeRetType = int64 + +func getBootVolumeGetSizeAttributeTypeOk(arg BootVolumeGetSizeAttributeType) (ret BootVolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetSizeAttributeType(arg *BootVolumeGetSizeAttributeType, val BootVolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type BootVolumeGetSourceAttributeType = *BootVolumeSource +type BootVolumeGetSourceArgType = BootVolumeSource +type BootVolumeGetSourceRetType = BootVolumeSource + +func getBootVolumeGetSourceAttributeTypeOk(arg BootVolumeGetSourceAttributeType) (ret BootVolumeGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeGetSourceAttributeType(arg *BootVolumeGetSourceAttributeType, val BootVolumeGetSourceRetType) { + *arg = &val +} + +// BootVolume The boot device for the server. +type BootVolume struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination BootVolumegetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + Id BootVolumeGetIdAttributeType `json:"id,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass BootVolumeGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Size in Gigabyte. + Size BootVolumeGetSizeAttributeType `json:"size,omitempty"` + Source BootVolumeGetSourceAttributeType `json:"source,omitempty"` +} + +// NewBootVolume instantiates a new BootVolume object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBootVolume() *BootVolume { + this := BootVolume{} + return &this +} + +// NewBootVolumeWithDefaults instantiates a new BootVolume object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBootVolumeWithDefaults() *BootVolume { + this := BootVolume{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *BootVolume) GetDeleteOnTermination() (res BootVolumegetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetDeleteOnTerminationOk() (ret BootVolumegetDeleteOnTerminationRetType, ok bool) { + return getBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *BootVolume) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *BootVolume) SetDeleteOnTermination(v BootVolumegetDeleteOnTerminationRetType) { + setBootVolumegetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BootVolume) GetId() (res BootVolumeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetIdOk() (ret BootVolumeGetIdRetType, ok bool) { + return getBootVolumeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *BootVolume) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BootVolume) SetId(v BootVolumeGetIdRetType) { + setBootVolumeGetIdAttributeType(&o.Id, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *BootVolume) GetPerformanceClass() (res BootVolumeGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetPerformanceClassOk() (ret BootVolumeGetPerformanceClassRetType, ok bool) { + return getBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *BootVolume) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *BootVolume) SetPerformanceClass(v BootVolumeGetPerformanceClassRetType) { + setBootVolumeGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *BootVolume) GetSize() (res BootVolumeGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetSizeOk() (ret BootVolumeGetSizeRetType, ok bool) { + return getBootVolumeGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *BootVolume) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *BootVolume) SetSize(v BootVolumeGetSizeRetType) { + setBootVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *BootVolume) GetSource() (res BootVolumeGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BootVolume) GetSourceOk() (ret BootVolumeGetSourceRetType, ok bool) { + return getBootVolumeGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *BootVolume) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given BootVolumeSource and assigns it to the Source field. +func (o *BootVolume) SetSource(v BootVolumeGetSourceRetType) { + setBootVolumeGetSourceAttributeType(&o.Source, v) +} + +func (o BootVolume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getBootVolumeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getBootVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getBootVolumeGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableBootVolume struct { + value *BootVolume + isSet bool +} + +func (v NullableBootVolume) Get() *BootVolume { + return v.value +} + +func (v *NullableBootVolume) Set(val *BootVolume) { + v.value = val + v.isSet = true +} + +func (v NullableBootVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableBootVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBootVolume(val *BootVolume) *NullableBootVolume { + return &NullableBootVolume{value: val, isSet: true} +} + +func (v NullableBootVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBootVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_boot_volume_source.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_boot_volume_source.go new file mode 100644 index 00000000..4fb08c37 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_boot_volume_source.go @@ -0,0 +1,172 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the BootVolumeSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BootVolumeSource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type BootVolumeSourceGetIdAttributeType = *string + +func getBootVolumeSourceGetIdAttributeTypeOk(arg BootVolumeSourceGetIdAttributeType) (ret BootVolumeSourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeSourceGetIdAttributeType(arg *BootVolumeSourceGetIdAttributeType, val BootVolumeSourceGetIdRetType) { + *arg = &val +} + +type BootVolumeSourceGetIdArgType = string +type BootVolumeSourceGetIdRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type BootVolumeSourceGetTypeAttributeType = *string + +func getBootVolumeSourceGetTypeAttributeTypeOk(arg BootVolumeSourceGetTypeAttributeType) (ret BootVolumeSourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setBootVolumeSourceGetTypeAttributeType(arg *BootVolumeSourceGetTypeAttributeType, val BootVolumeSourceGetTypeRetType) { + *arg = &val +} + +type BootVolumeSourceGetTypeArgType = string +type BootVolumeSourceGetTypeRetType = string + +// BootVolumeSource struct for BootVolumeSource +type BootVolumeSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id BootVolumeSourceGetIdAttributeType `json:"id" required:"true"` + // The source types of a boot volume. Possible values: `image`, `volume`. + // REQUIRED + Type BootVolumeSourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _BootVolumeSource BootVolumeSource + +// NewBootVolumeSource instantiates a new BootVolumeSource object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBootVolumeSource(id BootVolumeSourceGetIdArgType, types BootVolumeSourceGetTypeArgType) *BootVolumeSource { + this := BootVolumeSource{} + setBootVolumeSourceGetIdAttributeType(&this.Id, id) + setBootVolumeSourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewBootVolumeSourceWithDefaults instantiates a new BootVolumeSource object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBootVolumeSourceWithDefaults() *BootVolumeSource { + this := BootVolumeSource{} + return &this +} + +// GetId returns the Id field value +func (o *BootVolumeSource) GetId() (ret BootVolumeSourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *BootVolumeSource) GetIdOk() (ret BootVolumeSourceGetIdRetType, ok bool) { + return getBootVolumeSourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *BootVolumeSource) SetId(v BootVolumeSourceGetIdRetType) { + setBootVolumeSourceGetIdAttributeType(&o.Id, v) +} + +// GetType returns the Type field value +func (o *BootVolumeSource) GetType() (ret BootVolumeSourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *BootVolumeSource) GetTypeOk() (ret BootVolumeSourceGetTypeRetType, ok bool) { + return getBootVolumeSourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *BootVolumeSource) SetType(v BootVolumeSourceGetTypeRetType) { + setBootVolumeSourceGetTypeAttributeType(&o.Type, v) +} + +func (o BootVolumeSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getBootVolumeSourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getBootVolumeSourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableBootVolumeSource struct { + value *BootVolumeSource + isSet bool +} + +func (v NullableBootVolumeSource) Get() *BootVolumeSource { + return v.value +} + +func (v *NullableBootVolumeSource) Set(val *BootVolumeSource) { + v.value = val + v.isSet = true +} + +func (v NullableBootVolumeSource) IsSet() bool { + return v.isSet +} + +func (v *NullableBootVolumeSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBootVolumeSource(val *BootVolumeSource) *NullableBootVolumeSource { + return &NullableBootVolumeSource{value: val, isSet: true} +} + +func (v NullableBootVolumeSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBootVolumeSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_affinity_group_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_affinity_group_payload.go new file mode 100644 index 00000000..c9af3fbf --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_affinity_group_payload.go @@ -0,0 +1,269 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateAffinityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAffinityGroupPayload{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateAffinityGroupPayloadGetIdAttributeType = *string + +func getCreateAffinityGroupPayloadGetIdAttributeTypeOk(arg CreateAffinityGroupPayloadGetIdAttributeType) (ret CreateAffinityGroupPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetIdAttributeType(arg *CreateAffinityGroupPayloadGetIdAttributeType, val CreateAffinityGroupPayloadGetIdRetType) { + *arg = &val +} + +type CreateAffinityGroupPayloadGetIdArgType = string +type CreateAffinityGroupPayloadGetIdRetType = string + +/* + types and functions for members +*/ + +// isArray +type CreateAffinityGroupPayloadGetMembersAttributeType = *[]string +type CreateAffinityGroupPayloadGetMembersArgType = []string +type CreateAffinityGroupPayloadGetMembersRetType = []string + +func getCreateAffinityGroupPayloadGetMembersAttributeTypeOk(arg CreateAffinityGroupPayloadGetMembersAttributeType) (ret CreateAffinityGroupPayloadGetMembersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetMembersAttributeType(arg *CreateAffinityGroupPayloadGetMembersAttributeType, val CreateAffinityGroupPayloadGetMembersRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateAffinityGroupPayloadGetNameAttributeType = *string + +func getCreateAffinityGroupPayloadGetNameAttributeTypeOk(arg CreateAffinityGroupPayloadGetNameAttributeType) (ret CreateAffinityGroupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetNameAttributeType(arg *CreateAffinityGroupPayloadGetNameAttributeType, val CreateAffinityGroupPayloadGetNameRetType) { + *arg = &val +} + +type CreateAffinityGroupPayloadGetNameArgType = string +type CreateAffinityGroupPayloadGetNameRetType = string + +/* + types and functions for policy +*/ + +// isNotNullableString +type CreateAffinityGroupPayloadGetPolicyAttributeType = *string + +func getCreateAffinityGroupPayloadGetPolicyAttributeTypeOk(arg CreateAffinityGroupPayloadGetPolicyAttributeType) (ret CreateAffinityGroupPayloadGetPolicyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAffinityGroupPayloadGetPolicyAttributeType(arg *CreateAffinityGroupPayloadGetPolicyAttributeType, val CreateAffinityGroupPayloadGetPolicyRetType) { + *arg = &val +} + +type CreateAffinityGroupPayloadGetPolicyArgType = string +type CreateAffinityGroupPayloadGetPolicyRetType = string + +// CreateAffinityGroupPayload Definition of an affinity group. +type CreateAffinityGroupPayload struct { + // Universally Unique Identifier (UUID). + Id CreateAffinityGroupPayloadGetIdAttributeType `json:"id,omitempty"` + // The servers that are part of the affinity group. + Members CreateAffinityGroupPayloadGetMembersAttributeType `json:"members,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateAffinityGroupPayloadGetNameAttributeType `json:"name" required:"true"` + // The affinity group policy. `hard-affinity`: All servers in this group will be hosted on the same compute node. `soft-affinity`: All servers in this group will be hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in this group will be hosted on different compute nodes. `soft-anti-affinity`: All servers in this group will be hosted on as many compute nodes as possible. Possible values: `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, `soft-affinity`. + // REQUIRED + Policy CreateAffinityGroupPayloadGetPolicyAttributeType `json:"policy" required:"true"` +} + +type _CreateAffinityGroupPayload CreateAffinityGroupPayload + +// NewCreateAffinityGroupPayload instantiates a new CreateAffinityGroupPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateAffinityGroupPayload(name CreateAffinityGroupPayloadGetNameArgType, policy CreateAffinityGroupPayloadGetPolicyArgType) *CreateAffinityGroupPayload { + this := CreateAffinityGroupPayload{} + setCreateAffinityGroupPayloadGetNameAttributeType(&this.Name, name) + setCreateAffinityGroupPayloadGetPolicyAttributeType(&this.Policy, policy) + return &this +} + +// NewCreateAffinityGroupPayloadWithDefaults instantiates a new CreateAffinityGroupPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateAffinityGroupPayloadWithDefaults() *CreateAffinityGroupPayload { + this := CreateAffinityGroupPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateAffinityGroupPayload) GetId() (res CreateAffinityGroupPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetIdOk() (ret CreateAffinityGroupPayloadGetIdRetType, ok bool) { + return getCreateAffinityGroupPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateAffinityGroupPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateAffinityGroupPayload) SetId(v CreateAffinityGroupPayloadGetIdRetType) { + setCreateAffinityGroupPayloadGetIdAttributeType(&o.Id, v) +} + +// GetMembers returns the Members field value if set, zero value otherwise. +func (o *CreateAffinityGroupPayload) GetMembers() (res CreateAffinityGroupPayloadGetMembersRetType) { + res, _ = o.GetMembersOk() + return +} + +// GetMembersOk returns a tuple with the Members field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetMembersOk() (ret CreateAffinityGroupPayloadGetMembersRetType, ok bool) { + return getCreateAffinityGroupPayloadGetMembersAttributeTypeOk(o.Members) +} + +// HasMembers returns a boolean if a field has been set. +func (o *CreateAffinityGroupPayload) HasMembers() bool { + _, ok := o.GetMembersOk() + return ok +} + +// SetMembers gets a reference to the given []string and assigns it to the Members field. +func (o *CreateAffinityGroupPayload) SetMembers(v CreateAffinityGroupPayloadGetMembersRetType) { + setCreateAffinityGroupPayloadGetMembersAttributeType(&o.Members, v) +} + +// GetName returns the Name field value +func (o *CreateAffinityGroupPayload) GetName() (ret CreateAffinityGroupPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetNameOk() (ret CreateAffinityGroupPayloadGetNameRetType, ok bool) { + return getCreateAffinityGroupPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateAffinityGroupPayload) SetName(v CreateAffinityGroupPayloadGetNameRetType) { + setCreateAffinityGroupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPolicy returns the Policy field value +func (o *CreateAffinityGroupPayload) GetPolicy() (ret CreateAffinityGroupPayloadGetPolicyRetType) { + ret, _ = o.GetPolicyOk() + return ret +} + +// GetPolicyOk returns a tuple with the Policy field value +// and a boolean to check if the value has been set. +func (o *CreateAffinityGroupPayload) GetPolicyOk() (ret CreateAffinityGroupPayloadGetPolicyRetType, ok bool) { + return getCreateAffinityGroupPayloadGetPolicyAttributeTypeOk(o.Policy) +} + +// SetPolicy sets field value +func (o *CreateAffinityGroupPayload) SetPolicy(v CreateAffinityGroupPayloadGetPolicyRetType) { + setCreateAffinityGroupPayloadGetPolicyAttributeType(&o.Policy, v) +} + +func (o CreateAffinityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAffinityGroupPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateAffinityGroupPayloadGetMembersAttributeTypeOk(o.Members); ok { + toSerialize["Members"] = val + } + if val, ok := getCreateAffinityGroupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateAffinityGroupPayloadGetPolicyAttributeTypeOk(o.Policy); ok { + toSerialize["Policy"] = val + } + return toSerialize, nil +} + +type NullableCreateAffinityGroupPayload struct { + value *CreateAffinityGroupPayload + isSet bool +} + +func (v NullableCreateAffinityGroupPayload) Get() *CreateAffinityGroupPayload { + return v.value +} + +func (v *NullableCreateAffinityGroupPayload) Set(val *CreateAffinityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAffinityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAffinityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAffinityGroupPayload(val *CreateAffinityGroupPayload) *NullableCreateAffinityGroupPayload { + return &NullableCreateAffinityGroupPayload{value: val, isSet: true} +} + +func (v NullableCreateAffinityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAffinityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_area_address_family.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_area_address_family.go new file mode 100644 index 00000000..7d271dc5 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_area_address_family.go @@ -0,0 +1,127 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateAreaAddressFamily type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAreaAddressFamily{} + +/* + types and functions for ipv4 +*/ + +// isModel +type CreateAreaAddressFamilyGetIpv4AttributeType = *CreateAreaIPv4 +type CreateAreaAddressFamilyGetIpv4ArgType = CreateAreaIPv4 +type CreateAreaAddressFamilyGetIpv4RetType = CreateAreaIPv4 + +func getCreateAreaAddressFamilyGetIpv4AttributeTypeOk(arg CreateAreaAddressFamilyGetIpv4AttributeType) (ret CreateAreaAddressFamilyGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaAddressFamilyGetIpv4AttributeType(arg *CreateAreaAddressFamilyGetIpv4AttributeType, val CreateAreaAddressFamilyGetIpv4RetType) { + *arg = &val +} + +// CreateAreaAddressFamily The addressFamily object for a area create request. +type CreateAreaAddressFamily struct { + Ipv4 CreateAreaAddressFamilyGetIpv4AttributeType `json:"ipv4,omitempty"` +} + +// NewCreateAreaAddressFamily instantiates a new CreateAreaAddressFamily object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateAreaAddressFamily() *CreateAreaAddressFamily { + this := CreateAreaAddressFamily{} + return &this +} + +// NewCreateAreaAddressFamilyWithDefaults instantiates a new CreateAreaAddressFamily object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateAreaAddressFamilyWithDefaults() *CreateAreaAddressFamily { + this := CreateAreaAddressFamily{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateAreaAddressFamily) GetIpv4() (res CreateAreaAddressFamilyGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAreaAddressFamily) GetIpv4Ok() (ret CreateAreaAddressFamilyGetIpv4RetType, ok bool) { + return getCreateAreaAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateAreaAddressFamily) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given CreateAreaIPv4 and assigns it to the Ipv4 field. +func (o *CreateAreaAddressFamily) SetIpv4(v CreateAreaAddressFamilyGetIpv4RetType) { + setCreateAreaAddressFamilyGetIpv4AttributeType(&o.Ipv4, v) +} + +func (o CreateAreaAddressFamily) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAreaAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + return toSerialize, nil +} + +type NullableCreateAreaAddressFamily struct { + value *CreateAreaAddressFamily + isSet bool +} + +func (v NullableCreateAreaAddressFamily) Get() *CreateAreaAddressFamily { + return v.value +} + +func (v *NullableCreateAreaAddressFamily) Set(val *CreateAreaAddressFamily) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAreaAddressFamily) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAreaAddressFamily) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAreaAddressFamily(val *CreateAreaAddressFamily) *NullableCreateAreaAddressFamily { + return &NullableCreateAreaAddressFamily{value: val, isSet: true} +} + +func (v NullableCreateAreaAddressFamily) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAreaAddressFamily) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_area_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_area_ipv4.go new file mode 100644 index 00000000..5438c3dd --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_area_ipv4.go @@ -0,0 +1,416 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateAreaIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAreaIPv4{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type CreateAreaIPv4GetDefaultNameserversAttributeType = *[]string +type CreateAreaIPv4GetDefaultNameserversArgType = []string +type CreateAreaIPv4GetDefaultNameserversRetType = []string + +func getCreateAreaIPv4GetDefaultNameserversAttributeTypeOk(arg CreateAreaIPv4GetDefaultNameserversAttributeType) (ret CreateAreaIPv4GetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaIPv4GetDefaultNameserversAttributeType(arg *CreateAreaIPv4GetDefaultNameserversAttributeType, val CreateAreaIPv4GetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for networkRanges +*/ + +// isArray +type CreateAreaIPv4GetNetworkRangesAttributeType = *[]NetworkRange +type CreateAreaIPv4GetNetworkRangesArgType = []NetworkRange +type CreateAreaIPv4GetNetworkRangesRetType = []NetworkRange + +func getCreateAreaIPv4GetNetworkRangesAttributeTypeOk(arg CreateAreaIPv4GetNetworkRangesAttributeType) (ret CreateAreaIPv4GetNetworkRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaIPv4GetNetworkRangesAttributeType(arg *CreateAreaIPv4GetNetworkRangesAttributeType, val CreateAreaIPv4GetNetworkRangesRetType) { + *arg = &val +} + +/* + types and functions for routes +*/ + +// isArray +type CreateAreaIPv4GetRoutesAttributeType = *[]Route +type CreateAreaIPv4GetRoutesArgType = []Route +type CreateAreaIPv4GetRoutesRetType = []Route + +func getCreateAreaIPv4GetRoutesAttributeTypeOk(arg CreateAreaIPv4GetRoutesAttributeType) (ret CreateAreaIPv4GetRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaIPv4GetRoutesAttributeType(arg *CreateAreaIPv4GetRoutesAttributeType, val CreateAreaIPv4GetRoutesRetType) { + *arg = &val +} + +/* + types and functions for transferNetwork +*/ + +// isNotNullableString +type CreateAreaIPv4GetTransferNetworkAttributeType = *string + +func getCreateAreaIPv4GetTransferNetworkAttributeTypeOk(arg CreateAreaIPv4GetTransferNetworkAttributeType) (ret CreateAreaIPv4GetTransferNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaIPv4GetTransferNetworkAttributeType(arg *CreateAreaIPv4GetTransferNetworkAttributeType, val CreateAreaIPv4GetTransferNetworkRetType) { + *arg = &val +} + +type CreateAreaIPv4GetTransferNetworkArgType = string +type CreateAreaIPv4GetTransferNetworkRetType = string + +/* + types and functions for defaultPrefixLen +*/ + +// isInteger +type CreateAreaIPv4GetDefaultPrefixLenAttributeType = *int64 +type CreateAreaIPv4GetDefaultPrefixLenArgType = int64 +type CreateAreaIPv4GetDefaultPrefixLenRetType = int64 + +func getCreateAreaIPv4GetDefaultPrefixLenAttributeTypeOk(arg CreateAreaIPv4GetDefaultPrefixLenAttributeType) (ret CreateAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaIPv4GetDefaultPrefixLenAttributeType(arg *CreateAreaIPv4GetDefaultPrefixLenAttributeType, val CreateAreaIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isInteger +type CreateAreaIPv4GetMaxPrefixLenAttributeType = *int64 +type CreateAreaIPv4GetMaxPrefixLenArgType = int64 +type CreateAreaIPv4GetMaxPrefixLenRetType = int64 + +func getCreateAreaIPv4GetMaxPrefixLenAttributeTypeOk(arg CreateAreaIPv4GetMaxPrefixLenAttributeType) (ret CreateAreaIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaIPv4GetMaxPrefixLenAttributeType(arg *CreateAreaIPv4GetMaxPrefixLenAttributeType, val CreateAreaIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isInteger +type CreateAreaIPv4GetMinPrefixLenAttributeType = *int64 +type CreateAreaIPv4GetMinPrefixLenArgType = int64 +type CreateAreaIPv4GetMinPrefixLenRetType = int64 + +func getCreateAreaIPv4GetMinPrefixLenAttributeTypeOk(arg CreateAreaIPv4GetMinPrefixLenAttributeType) (ret CreateAreaIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAreaIPv4GetMinPrefixLenAttributeType(arg *CreateAreaIPv4GetMinPrefixLenAttributeType, val CreateAreaIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +// CreateAreaIPv4 The config object for a IPv4 network area. +type CreateAreaIPv4 struct { + DefaultNameservers CreateAreaIPv4GetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // A list of network ranges. + // REQUIRED + NetworkRanges CreateAreaIPv4GetNetworkRangesAttributeType `json:"networkRanges" required:"true"` + // A list of routes. + Routes CreateAreaIPv4GetRoutesAttributeType `json:"routes,omitempty"` + // Classless Inter-Domain Routing (CIDR). + // REQUIRED + TransferNetwork CreateAreaIPv4GetTransferNetworkAttributeType `json:"transferNetwork" required:"true"` + // The default prefix length for networks in the network area. + DefaultPrefixLen CreateAreaIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen,omitempty"` + // The maximal prefix length for networks in the network area. + MaxPrefixLen CreateAreaIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen,omitempty"` + // The minimal prefix length for networks in the network area. + MinPrefixLen CreateAreaIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen,omitempty"` +} + +type _CreateAreaIPv4 CreateAreaIPv4 + +// NewCreateAreaIPv4 instantiates a new CreateAreaIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateAreaIPv4(networkRanges CreateAreaIPv4GetNetworkRangesArgType, transferNetwork CreateAreaIPv4GetTransferNetworkArgType) *CreateAreaIPv4 { + this := CreateAreaIPv4{} + setCreateAreaIPv4GetNetworkRangesAttributeType(&this.NetworkRanges, networkRanges) + setCreateAreaIPv4GetTransferNetworkAttributeType(&this.TransferNetwork, transferNetwork) + return &this +} + +// NewCreateAreaIPv4WithDefaults instantiates a new CreateAreaIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateAreaIPv4WithDefaults() *CreateAreaIPv4 { + this := CreateAreaIPv4{} + var defaultPrefixLen int64 = 25 + this.DefaultPrefixLen = &defaultPrefixLen + var maxPrefixLen int64 = 29 + this.MaxPrefixLen = &maxPrefixLen + var minPrefixLen int64 = 24 + this.MinPrefixLen = &minPrefixLen + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *CreateAreaIPv4) GetDefaultNameservers() (res CreateAreaIPv4GetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAreaIPv4) GetDefaultNameserversOk() (ret CreateAreaIPv4GetDefaultNameserversRetType, ok bool) { + return getCreateAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *CreateAreaIPv4) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *CreateAreaIPv4) SetDefaultNameservers(v CreateAreaIPv4GetDefaultNameserversRetType) { + setCreateAreaIPv4GetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetNetworkRanges returns the NetworkRanges field value +func (o *CreateAreaIPv4) GetNetworkRanges() (ret CreateAreaIPv4GetNetworkRangesRetType) { + ret, _ = o.GetNetworkRangesOk() + return ret +} + +// GetNetworkRangesOk returns a tuple with the NetworkRanges field value +// and a boolean to check if the value has been set. +func (o *CreateAreaIPv4) GetNetworkRangesOk() (ret CreateAreaIPv4GetNetworkRangesRetType, ok bool) { + return getCreateAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges) +} + +// SetNetworkRanges sets field value +func (o *CreateAreaIPv4) SetNetworkRanges(v CreateAreaIPv4GetNetworkRangesRetType) { + setCreateAreaIPv4GetNetworkRangesAttributeType(&o.NetworkRanges, v) +} + +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *CreateAreaIPv4) GetRoutes() (res CreateAreaIPv4GetRoutesRetType) { + res, _ = o.GetRoutesOk() + return +} + +// GetRoutesOk returns a tuple with the Routes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAreaIPv4) GetRoutesOk() (ret CreateAreaIPv4GetRoutesRetType, ok bool) { + return getCreateAreaIPv4GetRoutesAttributeTypeOk(o.Routes) +} + +// HasRoutes returns a boolean if a field has been set. +func (o *CreateAreaIPv4) HasRoutes() bool { + _, ok := o.GetRoutesOk() + return ok +} + +// SetRoutes gets a reference to the given []Route and assigns it to the Routes field. +func (o *CreateAreaIPv4) SetRoutes(v CreateAreaIPv4GetRoutesRetType) { + setCreateAreaIPv4GetRoutesAttributeType(&o.Routes, v) +} + +// GetTransferNetwork returns the TransferNetwork field value +func (o *CreateAreaIPv4) GetTransferNetwork() (ret CreateAreaIPv4GetTransferNetworkRetType) { + ret, _ = o.GetTransferNetworkOk() + return ret +} + +// GetTransferNetworkOk returns a tuple with the TransferNetwork field value +// and a boolean to check if the value has been set. +func (o *CreateAreaIPv4) GetTransferNetworkOk() (ret CreateAreaIPv4GetTransferNetworkRetType, ok bool) { + return getCreateAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork) +} + +// SetTransferNetwork sets field value +func (o *CreateAreaIPv4) SetTransferNetwork(v CreateAreaIPv4GetTransferNetworkRetType) { + setCreateAreaIPv4GetTransferNetworkAttributeType(&o.TransferNetwork, v) +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value if set, zero value otherwise. +func (o *CreateAreaIPv4) GetDefaultPrefixLen() (res CreateAreaIPv4GetDefaultPrefixLenRetType) { + res, _ = o.GetDefaultPrefixLenOk() + return +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAreaIPv4) GetDefaultPrefixLenOk() (ret CreateAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + return getCreateAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// HasDefaultPrefixLen returns a boolean if a field has been set. +func (o *CreateAreaIPv4) HasDefaultPrefixLen() bool { + _, ok := o.GetDefaultPrefixLenOk() + return ok +} + +// SetDefaultPrefixLen gets a reference to the given int64 and assigns it to the DefaultPrefixLen field. +func (o *CreateAreaIPv4) SetDefaultPrefixLen(v CreateAreaIPv4GetDefaultPrefixLenRetType) { + setCreateAreaIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value if set, zero value otherwise. +func (o *CreateAreaIPv4) GetMaxPrefixLen() (res CreateAreaIPv4GetMaxPrefixLenRetType) { + res, _ = o.GetMaxPrefixLenOk() + return +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAreaIPv4) GetMaxPrefixLenOk() (ret CreateAreaIPv4GetMaxPrefixLenRetType, ok bool) { + return getCreateAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// HasMaxPrefixLen returns a boolean if a field has been set. +func (o *CreateAreaIPv4) HasMaxPrefixLen() bool { + _, ok := o.GetMaxPrefixLenOk() + return ok +} + +// SetMaxPrefixLen gets a reference to the given int64 and assigns it to the MaxPrefixLen field. +func (o *CreateAreaIPv4) SetMaxPrefixLen(v CreateAreaIPv4GetMaxPrefixLenRetType) { + setCreateAreaIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value if set, zero value otherwise. +func (o *CreateAreaIPv4) GetMinPrefixLen() (res CreateAreaIPv4GetMinPrefixLenRetType) { + res, _ = o.GetMinPrefixLenOk() + return +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAreaIPv4) GetMinPrefixLenOk() (ret CreateAreaIPv4GetMinPrefixLenRetType, ok bool) { + return getCreateAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// HasMinPrefixLen returns a boolean if a field has been set. +func (o *CreateAreaIPv4) HasMinPrefixLen() bool { + _, ok := o.GetMinPrefixLenOk() + return ok +} + +// SetMinPrefixLen gets a reference to the given int64 and assigns it to the MinPrefixLen field. +func (o *CreateAreaIPv4) SetMinPrefixLen(v CreateAreaIPv4GetMinPrefixLenRetType) { + setCreateAreaIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +func (o CreateAreaIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getCreateAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges); ok { + toSerialize["NetworkRanges"] = val + } + if val, ok := getCreateAreaIPv4GetRoutesAttributeTypeOk(o.Routes); ok { + toSerialize["Routes"] = val + } + if val, ok := getCreateAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork); ok { + toSerialize["TransferNetwork"] = val + } + if val, ok := getCreateAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getCreateAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getCreateAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + return toSerialize, nil +} + +type NullableCreateAreaIPv4 struct { + value *CreateAreaIPv4 + isSet bool +} + +func (v NullableCreateAreaIPv4) Get() *CreateAreaIPv4 { + return v.value +} + +func (v *NullableCreateAreaIPv4) Set(val *CreateAreaIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAreaIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAreaIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAreaIPv4(val *CreateAreaIPv4) *NullableCreateAreaIPv4 { + return &NullableCreateAreaIPv4{value: val, isSet: true} +} + +func (v NullableCreateAreaIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAreaIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_backup_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_backup_payload.go new file mode 100644 index 00000000..78b84a47 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_backup_payload.go @@ -0,0 +1,222 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateBackupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateBackupPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateBackupPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateBackupPayloadGetLabelsArgType = map[string]interface{} +type CreateBackupPayloadGetLabelsRetType = map[string]interface{} + +func getCreateBackupPayloadGetLabelsAttributeTypeOk(arg CreateBackupPayloadGetLabelsAttributeType) (ret CreateBackupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetLabelsAttributeType(arg *CreateBackupPayloadGetLabelsAttributeType, val CreateBackupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateBackupPayloadGetNameAttributeType = *string + +func getCreateBackupPayloadGetNameAttributeTypeOk(arg CreateBackupPayloadGetNameAttributeType) (ret CreateBackupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetNameAttributeType(arg *CreateBackupPayloadGetNameAttributeType, val CreateBackupPayloadGetNameRetType) { + *arg = &val +} + +type CreateBackupPayloadGetNameArgType = string +type CreateBackupPayloadGetNameRetType = string + +/* + types and functions for source +*/ + +// isModel +type CreateBackupPayloadGetSourceAttributeType = *BackupSource +type CreateBackupPayloadGetSourceArgType = BackupSource +type CreateBackupPayloadGetSourceRetType = BackupSource + +func getCreateBackupPayloadGetSourceAttributeTypeOk(arg CreateBackupPayloadGetSourceAttributeType) (ret CreateBackupPayloadGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateBackupPayloadGetSourceAttributeType(arg *CreateBackupPayloadGetSourceAttributeType, val CreateBackupPayloadGetSourceRetType) { + *arg = &val +} + +// CreateBackupPayload Object that represents a backup create request body. +type CreateBackupPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateBackupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name CreateBackupPayloadGetNameAttributeType `json:"name,omitempty"` + // REQUIRED + Source CreateBackupPayloadGetSourceAttributeType `json:"source" required:"true"` +} + +type _CreateBackupPayload CreateBackupPayload + +// NewCreateBackupPayload instantiates a new CreateBackupPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateBackupPayload(source CreateBackupPayloadGetSourceArgType) *CreateBackupPayload { + this := CreateBackupPayload{} + setCreateBackupPayloadGetSourceAttributeType(&this.Source, source) + return &this +} + +// NewCreateBackupPayloadWithDefaults instantiates a new CreateBackupPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateBackupPayloadWithDefaults() *CreateBackupPayload { + this := CreateBackupPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateBackupPayload) GetLabels() (res CreateBackupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetLabelsOk() (ret CreateBackupPayloadGetLabelsRetType, ok bool) { + return getCreateBackupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateBackupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateBackupPayload) SetLabels(v CreateBackupPayloadGetLabelsRetType) { + setCreateBackupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateBackupPayload) GetName() (res CreateBackupPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetNameOk() (ret CreateBackupPayloadGetNameRetType, ok bool) { + return getCreateBackupPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateBackupPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateBackupPayload) SetName(v CreateBackupPayloadGetNameRetType) { + setCreateBackupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSource returns the Source field value +func (o *CreateBackupPayload) GetSource() (ret CreateBackupPayloadGetSourceRetType) { + ret, _ = o.GetSourceOk() + return ret +} + +// GetSourceOk returns a tuple with the Source field value +// and a boolean to check if the value has been set. +func (o *CreateBackupPayload) GetSourceOk() (ret CreateBackupPayloadGetSourceRetType, ok bool) { + return getCreateBackupPayloadGetSourceAttributeTypeOk(o.Source) +} + +// SetSource sets field value +func (o *CreateBackupPayload) SetSource(v CreateBackupPayloadGetSourceRetType) { + setCreateBackupPayloadGetSourceAttributeType(&o.Source, v) +} + +func (o CreateBackupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateBackupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateBackupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateBackupPayloadGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableCreateBackupPayload struct { + value *CreateBackupPayload + isSet bool +} + +func (v NullableCreateBackupPayload) Get() *CreateBackupPayload { + return v.value +} + +func (v *NullableCreateBackupPayload) Set(val *CreateBackupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateBackupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateBackupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateBackupPayload(val *CreateBackupPayload) *NullableCreateBackupPayload { + return &NullableCreateBackupPayload{value: val, isSet: true} +} + +func (v NullableCreateBackupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateBackupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_image_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_image_payload.go new file mode 100644 index 00000000..95eb4adb --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_image_payload.go @@ -0,0 +1,846 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateImagePayload{} + +/* + types and functions for agent +*/ + +// isModel +type CreateImagePayloadGetAgentAttributeType = *ImageAgent +type CreateImagePayloadGetAgentArgType = ImageAgent +type CreateImagePayloadGetAgentRetType = ImageAgent + +func getCreateImagePayloadGetAgentAttributeTypeOk(arg CreateImagePayloadGetAgentAttributeType) (ret CreateImagePayloadGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetAgentAttributeType(arg *CreateImagePayloadGetAgentAttributeType, val CreateImagePayloadGetAgentRetType) { + *arg = &val +} + +/* + types and functions for checksum +*/ + +// isModel +type CreateImagePayloadGetChecksumAttributeType = *ImageChecksum +type CreateImagePayloadGetChecksumArgType = ImageChecksum +type CreateImagePayloadGetChecksumRetType = ImageChecksum + +func getCreateImagePayloadGetChecksumAttributeTypeOk(arg CreateImagePayloadGetChecksumAttributeType) (ret CreateImagePayloadGetChecksumRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetChecksumAttributeType(arg *CreateImagePayloadGetChecksumAttributeType, val CreateImagePayloadGetChecksumRetType) { + *arg = &val +} + +/* + types and functions for config +*/ + +// isModel +type CreateImagePayloadGetConfigAttributeType = *ImageConfig +type CreateImagePayloadGetConfigArgType = ImageConfig +type CreateImagePayloadGetConfigRetType = ImageConfig + +func getCreateImagePayloadGetConfigAttributeTypeOk(arg CreateImagePayloadGetConfigAttributeType) (ret CreateImagePayloadGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetConfigAttributeType(arg *CreateImagePayloadGetConfigAttributeType, val CreateImagePayloadGetConfigRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateImagePayloadGetCreatedAtAttributeType = *time.Time +type CreateImagePayloadGetCreatedAtArgType = time.Time +type CreateImagePayloadGetCreatedAtRetType = time.Time + +func getCreateImagePayloadGetCreatedAtAttributeTypeOk(arg CreateImagePayloadGetCreatedAtAttributeType) (ret CreateImagePayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetCreatedAtAttributeType(arg *CreateImagePayloadGetCreatedAtAttributeType, val CreateImagePayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for diskFormat +*/ + +// isNotNullableString +type CreateImagePayloadGetDiskFormatAttributeType = *string + +func getCreateImagePayloadGetDiskFormatAttributeTypeOk(arg CreateImagePayloadGetDiskFormatAttributeType) (ret CreateImagePayloadGetDiskFormatRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetDiskFormatAttributeType(arg *CreateImagePayloadGetDiskFormatAttributeType, val CreateImagePayloadGetDiskFormatRetType) { + *arg = &val +} + +type CreateImagePayloadGetDiskFormatArgType = string +type CreateImagePayloadGetDiskFormatRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateImagePayloadGetIdAttributeType = *string + +func getCreateImagePayloadGetIdAttributeTypeOk(arg CreateImagePayloadGetIdAttributeType) (ret CreateImagePayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetIdAttributeType(arg *CreateImagePayloadGetIdAttributeType, val CreateImagePayloadGetIdRetType) { + *arg = &val +} + +type CreateImagePayloadGetIdArgType = string +type CreateImagePayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateImagePayloadGetLabelsAttributeType = *map[string]interface{} +type CreateImagePayloadGetLabelsArgType = map[string]interface{} +type CreateImagePayloadGetLabelsRetType = map[string]interface{} + +func getCreateImagePayloadGetLabelsAttributeTypeOk(arg CreateImagePayloadGetLabelsAttributeType) (ret CreateImagePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetLabelsAttributeType(arg *CreateImagePayloadGetLabelsAttributeType, val CreateImagePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for minDiskSize +*/ + +// isLong +type CreateImagePayloadGetMinDiskSizeAttributeType = *int64 +type CreateImagePayloadGetMinDiskSizeArgType = int64 +type CreateImagePayloadGetMinDiskSizeRetType = int64 + +func getCreateImagePayloadGetMinDiskSizeAttributeTypeOk(arg CreateImagePayloadGetMinDiskSizeAttributeType) (ret CreateImagePayloadGetMinDiskSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetMinDiskSizeAttributeType(arg *CreateImagePayloadGetMinDiskSizeAttributeType, val CreateImagePayloadGetMinDiskSizeRetType) { + *arg = &val +} + +/* + types and functions for minRam +*/ + +// isLong +type CreateImagePayloadGetMinRamAttributeType = *int64 +type CreateImagePayloadGetMinRamArgType = int64 +type CreateImagePayloadGetMinRamRetType = int64 + +func getCreateImagePayloadGetMinRamAttributeTypeOk(arg CreateImagePayloadGetMinRamAttributeType) (ret CreateImagePayloadGetMinRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetMinRamAttributeType(arg *CreateImagePayloadGetMinRamAttributeType, val CreateImagePayloadGetMinRamRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateImagePayloadGetNameAttributeType = *string + +func getCreateImagePayloadGetNameAttributeTypeOk(arg CreateImagePayloadGetNameAttributeType) (ret CreateImagePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetNameAttributeType(arg *CreateImagePayloadGetNameAttributeType, val CreateImagePayloadGetNameRetType) { + *arg = &val +} + +type CreateImagePayloadGetNameArgType = string +type CreateImagePayloadGetNameRetType = string + +/* + types and functions for owner +*/ + +// isNotNullableString +type CreateImagePayloadGetOwnerAttributeType = *string + +func getCreateImagePayloadGetOwnerAttributeTypeOk(arg CreateImagePayloadGetOwnerAttributeType) (ret CreateImagePayloadGetOwnerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetOwnerAttributeType(arg *CreateImagePayloadGetOwnerAttributeType, val CreateImagePayloadGetOwnerRetType) { + *arg = &val +} + +type CreateImagePayloadGetOwnerArgType = string +type CreateImagePayloadGetOwnerRetType = string + +/* + types and functions for protected +*/ + +// isBoolean +type CreateImagePayloadgetProtectedAttributeType = *bool +type CreateImagePayloadgetProtectedArgType = bool +type CreateImagePayloadgetProtectedRetType = bool + +func getCreateImagePayloadgetProtectedAttributeTypeOk(arg CreateImagePayloadgetProtectedAttributeType) (ret CreateImagePayloadgetProtectedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadgetProtectedAttributeType(arg *CreateImagePayloadgetProtectedAttributeType, val CreateImagePayloadgetProtectedRetType) { + *arg = &val +} + +/* + types and functions for scope +*/ + +// isNotNullableString +type CreateImagePayloadGetScopeAttributeType = *string + +func getCreateImagePayloadGetScopeAttributeTypeOk(arg CreateImagePayloadGetScopeAttributeType) (ret CreateImagePayloadGetScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetScopeAttributeType(arg *CreateImagePayloadGetScopeAttributeType, val CreateImagePayloadGetScopeRetType) { + *arg = &val +} + +type CreateImagePayloadGetScopeArgType = string +type CreateImagePayloadGetScopeRetType = string + +/* + types and functions for size +*/ + +// isLong +type CreateImagePayloadGetSizeAttributeType = *int64 +type CreateImagePayloadGetSizeArgType = int64 +type CreateImagePayloadGetSizeRetType = int64 + +func getCreateImagePayloadGetSizeAttributeTypeOk(arg CreateImagePayloadGetSizeAttributeType) (ret CreateImagePayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetSizeAttributeType(arg *CreateImagePayloadGetSizeAttributeType, val CreateImagePayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateImagePayloadGetStatusAttributeType = *string + +func getCreateImagePayloadGetStatusAttributeTypeOk(arg CreateImagePayloadGetStatusAttributeType) (ret CreateImagePayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetStatusAttributeType(arg *CreateImagePayloadGetStatusAttributeType, val CreateImagePayloadGetStatusRetType) { + *arg = &val +} + +type CreateImagePayloadGetStatusArgType = string +type CreateImagePayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateImagePayloadGetUpdatedAtAttributeType = *time.Time +type CreateImagePayloadGetUpdatedAtArgType = time.Time +type CreateImagePayloadGetUpdatedAtRetType = time.Time + +func getCreateImagePayloadGetUpdatedAtAttributeTypeOk(arg CreateImagePayloadGetUpdatedAtAttributeType) (ret CreateImagePayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateImagePayloadGetUpdatedAtAttributeType(arg *CreateImagePayloadGetUpdatedAtAttributeType, val CreateImagePayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateImagePayload Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type CreateImagePayload struct { + Agent CreateImagePayloadGetAgentAttributeType `json:"agent,omitempty"` + Checksum CreateImagePayloadGetChecksumAttributeType `json:"checksum,omitempty"` + Config CreateImagePayloadGetConfigAttributeType `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt CreateImagePayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. + // REQUIRED + DiskFormat CreateImagePayloadGetDiskFormatAttributeType `json:"diskFormat" required:"true"` + // Universally Unique Identifier (UUID). + Id CreateImagePayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateImagePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize CreateImagePayloadGetMinDiskSizeAttributeType `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam CreateImagePayloadGetMinRamAttributeType `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateImagePayloadGetNameAttributeType `json:"name" required:"true"` + // Universally Unique Identifier (UUID). + Owner CreateImagePayloadGetOwnerAttributeType `json:"owner,omitempty"` + // When true the image is prevented from being deleted. + Protected CreateImagePayloadgetProtectedAttributeType `json:"protected,omitempty"` + // Scope of an Image. Possible values: `public`, `local`, `projects`, `organization`. + Scope CreateImagePayloadGetScopeAttributeType `json:"scope,omitempty"` + // Size in bytes. + Size CreateImagePayloadGetSizeAttributeType `json:"size,omitempty"` + // The status of an image object. Possible values: `AVAILABLE`, `CREATING`, `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + Status CreateImagePayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateImagePayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateImagePayload CreateImagePayload + +// NewCreateImagePayload instantiates a new CreateImagePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateImagePayload(diskFormat CreateImagePayloadGetDiskFormatArgType, name CreateImagePayloadGetNameArgType) *CreateImagePayload { + this := CreateImagePayload{} + setCreateImagePayloadGetDiskFormatAttributeType(&this.DiskFormat, diskFormat) + setCreateImagePayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateImagePayloadWithDefaults instantiates a new CreateImagePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateImagePayloadWithDefaults() *CreateImagePayload { + this := CreateImagePayload{} + return &this +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *CreateImagePayload) GetAgent() (res CreateImagePayloadGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetAgentOk() (ret CreateImagePayloadGetAgentRetType, ok bool) { + return getCreateImagePayloadGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *CreateImagePayload) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ImageAgent and assigns it to the Agent field. +func (o *CreateImagePayload) SetAgent(v CreateImagePayloadGetAgentRetType) { + setCreateImagePayloadGetAgentAttributeType(&o.Agent, v) +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *CreateImagePayload) GetChecksum() (res CreateImagePayloadGetChecksumRetType) { + res, _ = o.GetChecksumOk() + return +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetChecksumOk() (ret CreateImagePayloadGetChecksumRetType, ok bool) { + return getCreateImagePayloadGetChecksumAttributeTypeOk(o.Checksum) +} + +// HasChecksum returns a boolean if a field has been set. +func (o *CreateImagePayload) HasChecksum() bool { + _, ok := o.GetChecksumOk() + return ok +} + +// SetChecksum gets a reference to the given ImageChecksum and assigns it to the Checksum field. +func (o *CreateImagePayload) SetChecksum(v CreateImagePayloadGetChecksumRetType) { + setCreateImagePayloadGetChecksumAttributeType(&o.Checksum, v) +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *CreateImagePayload) GetConfig() (res CreateImagePayloadGetConfigRetType) { + res, _ = o.GetConfigOk() + return +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetConfigOk() (ret CreateImagePayloadGetConfigRetType, ok bool) { + return getCreateImagePayloadGetConfigAttributeTypeOk(o.Config) +} + +// HasConfig returns a boolean if a field has been set. +func (o *CreateImagePayload) HasConfig() bool { + _, ok := o.GetConfigOk() + return ok +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *CreateImagePayload) SetConfig(v CreateImagePayloadGetConfigRetType) { + setCreateImagePayloadGetConfigAttributeType(&o.Config, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetCreatedAt() (res CreateImagePayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetCreatedAtOk() (ret CreateImagePayloadGetCreatedAtRetType, ok bool) { + return getCreateImagePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateImagePayload) SetCreatedAt(v CreateImagePayloadGetCreatedAtRetType) { + setCreateImagePayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDiskFormat returns the DiskFormat field value +func (o *CreateImagePayload) GetDiskFormat() (ret CreateImagePayloadGetDiskFormatRetType) { + ret, _ = o.GetDiskFormatOk() + return ret +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetDiskFormatOk() (ret CreateImagePayloadGetDiskFormatRetType, ok bool) { + return getCreateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat) +} + +// SetDiskFormat sets field value +func (o *CreateImagePayload) SetDiskFormat(v CreateImagePayloadGetDiskFormatRetType) { + setCreateImagePayloadGetDiskFormatAttributeType(&o.DiskFormat, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateImagePayload) GetId() (res CreateImagePayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetIdOk() (ret CreateImagePayloadGetIdRetType, ok bool) { + return getCreateImagePayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateImagePayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateImagePayload) SetId(v CreateImagePayloadGetIdRetType) { + setCreateImagePayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateImagePayload) GetLabels() (res CreateImagePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetLabelsOk() (ret CreateImagePayloadGetLabelsRetType, ok bool) { + return getCreateImagePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateImagePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateImagePayload) SetLabels(v CreateImagePayloadGetLabelsRetType) { + setCreateImagePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinDiskSize() (res CreateImagePayloadGetMinDiskSizeRetType) { + res, _ = o.GetMinDiskSizeOk() + return +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinDiskSizeOk() (ret CreateImagePayloadGetMinDiskSizeRetType, ok bool) { + return getCreateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize) +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinDiskSize() bool { + _, ok := o.GetMinDiskSizeOk() + return ok +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *CreateImagePayload) SetMinDiskSize(v CreateImagePayloadGetMinDiskSizeRetType) { + setCreateImagePayloadGetMinDiskSizeAttributeType(&o.MinDiskSize, v) +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *CreateImagePayload) GetMinRam() (res CreateImagePayloadGetMinRamRetType) { + res, _ = o.GetMinRamOk() + return +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetMinRamOk() (ret CreateImagePayloadGetMinRamRetType, ok bool) { + return getCreateImagePayloadGetMinRamAttributeTypeOk(o.MinRam) +} + +// HasMinRam returns a boolean if a field has been set. +func (o *CreateImagePayload) HasMinRam() bool { + _, ok := o.GetMinRamOk() + return ok +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *CreateImagePayload) SetMinRam(v CreateImagePayloadGetMinRamRetType) { + setCreateImagePayloadGetMinRamAttributeType(&o.MinRam, v) +} + +// GetName returns the Name field value +func (o *CreateImagePayload) GetName() (ret CreateImagePayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetNameOk() (ret CreateImagePayloadGetNameRetType, ok bool) { + return getCreateImagePayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateImagePayload) SetName(v CreateImagePayloadGetNameRetType) { + setCreateImagePayloadGetNameAttributeType(&o.Name, v) +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *CreateImagePayload) GetOwner() (res CreateImagePayloadGetOwnerRetType) { + res, _ = o.GetOwnerOk() + return +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetOwnerOk() (ret CreateImagePayloadGetOwnerRetType, ok bool) { + return getCreateImagePayloadGetOwnerAttributeTypeOk(o.Owner) +} + +// HasOwner returns a boolean if a field has been set. +func (o *CreateImagePayload) HasOwner() bool { + _, ok := o.GetOwnerOk() + return ok +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *CreateImagePayload) SetOwner(v CreateImagePayloadGetOwnerRetType) { + setCreateImagePayloadGetOwnerAttributeType(&o.Owner, v) +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *CreateImagePayload) GetProtected() (res CreateImagePayloadgetProtectedRetType) { + res, _ = o.GetProtectedOk() + return +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetProtectedOk() (ret CreateImagePayloadgetProtectedRetType, ok bool) { + return getCreateImagePayloadgetProtectedAttributeTypeOk(o.Protected) +} + +// HasProtected returns a boolean if a field has been set. +func (o *CreateImagePayload) HasProtected() bool { + _, ok := o.GetProtectedOk() + return ok +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *CreateImagePayload) SetProtected(v CreateImagePayloadgetProtectedRetType) { + setCreateImagePayloadgetProtectedAttributeType(&o.Protected, v) +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *CreateImagePayload) GetScope() (res CreateImagePayloadGetScopeRetType) { + res, _ = o.GetScopeOk() + return +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetScopeOk() (ret CreateImagePayloadGetScopeRetType, ok bool) { + return getCreateImagePayloadGetScopeAttributeTypeOk(o.Scope) +} + +// HasScope returns a boolean if a field has been set. +func (o *CreateImagePayload) HasScope() bool { + _, ok := o.GetScopeOk() + return ok +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *CreateImagePayload) SetScope(v CreateImagePayloadGetScopeRetType) { + setCreateImagePayloadGetScopeAttributeType(&o.Scope, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateImagePayload) GetSize() (res CreateImagePayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetSizeOk() (ret CreateImagePayloadGetSizeRetType, ok bool) { + return getCreateImagePayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateImagePayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateImagePayload) SetSize(v CreateImagePayloadGetSizeRetType) { + setCreateImagePayloadGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateImagePayload) GetStatus() (res CreateImagePayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetStatusOk() (ret CreateImagePayloadGetStatusRetType, ok bool) { + return getCreateImagePayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateImagePayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateImagePayload) SetStatus(v CreateImagePayloadGetStatusRetType) { + setCreateImagePayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateImagePayload) GetUpdatedAt() (res CreateImagePayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetUpdatedAtOk() (ret CreateImagePayloadGetUpdatedAtRetType, ok bool) { + return getCreateImagePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateImagePayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateImagePayload) SetUpdatedAt(v CreateImagePayloadGetUpdatedAtRetType) { + setCreateImagePayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateImagePayloadGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getCreateImagePayloadGetChecksumAttributeTypeOk(o.Checksum); ok { + toSerialize["Checksum"] = val + } + if val, ok := getCreateImagePayloadGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getCreateImagePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat); ok { + toSerialize["DiskFormat"] = val + } + if val, ok := getCreateImagePayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateImagePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize); ok { + toSerialize["MinDiskSize"] = val + } + if val, ok := getCreateImagePayloadGetMinRamAttributeTypeOk(o.MinRam); ok { + toSerialize["MinRam"] = val + } + if val, ok := getCreateImagePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateImagePayloadGetOwnerAttributeTypeOk(o.Owner); ok { + toSerialize["Owner"] = val + } + if val, ok := getCreateImagePayloadgetProtectedAttributeTypeOk(o.Protected); ok { + toSerialize["Protected"] = val + } + if val, ok := getCreateImagePayloadGetScopeAttributeTypeOk(o.Scope); ok { + toSerialize["Scope"] = val + } + if val, ok := getCreateImagePayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getCreateImagePayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateImagePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateImagePayload struct { + value *CreateImagePayload + isSet bool +} + +func (v NullableCreateImagePayload) Get() *CreateImagePayload { + return v.value +} + +func (v *NullableCreateImagePayload) Set(val *CreateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateImagePayload(val *CreateImagePayload) *NullableCreateImagePayload { + return &NullableCreateImagePayload{value: val, isSet: true} +} + +func (v NullableCreateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_key_pair_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_key_pair_payload.go new file mode 100644 index 00000000..d856e0a8 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_key_pair_payload.go @@ -0,0 +1,370 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateKeyPairPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateKeyPairPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateKeyPairPayloadGetCreatedAtAttributeType = *time.Time +type CreateKeyPairPayloadGetCreatedAtArgType = time.Time +type CreateKeyPairPayloadGetCreatedAtRetType = time.Time + +func getCreateKeyPairPayloadGetCreatedAtAttributeTypeOk(arg CreateKeyPairPayloadGetCreatedAtAttributeType) (ret CreateKeyPairPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetCreatedAtAttributeType(arg *CreateKeyPairPayloadGetCreatedAtAttributeType, val CreateKeyPairPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for fingerprint +*/ + +// isNotNullableString +type CreateKeyPairPayloadGetFingerprintAttributeType = *string + +func getCreateKeyPairPayloadGetFingerprintAttributeTypeOk(arg CreateKeyPairPayloadGetFingerprintAttributeType) (ret CreateKeyPairPayloadGetFingerprintRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetFingerprintAttributeType(arg *CreateKeyPairPayloadGetFingerprintAttributeType, val CreateKeyPairPayloadGetFingerprintRetType) { + *arg = &val +} + +type CreateKeyPairPayloadGetFingerprintArgType = string +type CreateKeyPairPayloadGetFingerprintRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateKeyPairPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateKeyPairPayloadGetLabelsArgType = map[string]interface{} +type CreateKeyPairPayloadGetLabelsRetType = map[string]interface{} + +func getCreateKeyPairPayloadGetLabelsAttributeTypeOk(arg CreateKeyPairPayloadGetLabelsAttributeType) (ret CreateKeyPairPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetLabelsAttributeType(arg *CreateKeyPairPayloadGetLabelsAttributeType, val CreateKeyPairPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateKeyPairPayloadGetNameAttributeType = *string + +func getCreateKeyPairPayloadGetNameAttributeTypeOk(arg CreateKeyPairPayloadGetNameAttributeType) (ret CreateKeyPairPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetNameAttributeType(arg *CreateKeyPairPayloadGetNameAttributeType, val CreateKeyPairPayloadGetNameRetType) { + *arg = &val +} + +type CreateKeyPairPayloadGetNameArgType = string +type CreateKeyPairPayloadGetNameRetType = string + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type CreateKeyPairPayloadGetPublicKeyAttributeType = *string + +func getCreateKeyPairPayloadGetPublicKeyAttributeTypeOk(arg CreateKeyPairPayloadGetPublicKeyAttributeType) (ret CreateKeyPairPayloadGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetPublicKeyAttributeType(arg *CreateKeyPairPayloadGetPublicKeyAttributeType, val CreateKeyPairPayloadGetPublicKeyRetType) { + *arg = &val +} + +type CreateKeyPairPayloadGetPublicKeyArgType = string +type CreateKeyPairPayloadGetPublicKeyRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateKeyPairPayloadGetUpdatedAtAttributeType = *time.Time +type CreateKeyPairPayloadGetUpdatedAtArgType = time.Time +type CreateKeyPairPayloadGetUpdatedAtRetType = time.Time + +func getCreateKeyPairPayloadGetUpdatedAtAttributeTypeOk(arg CreateKeyPairPayloadGetUpdatedAtAttributeType) (ret CreateKeyPairPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateKeyPairPayloadGetUpdatedAtAttributeType(arg *CreateKeyPairPayloadGetUpdatedAtAttributeType, val CreateKeyPairPayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateKeyPairPayload Object that represents the public key of an SSH keypair and its name. +type CreateKeyPairPayload struct { + // Date-time when resource was created. + CreatedAt CreateKeyPairPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents an SSH keypair MD5 fingerprint. + Fingerprint CreateKeyPairPayloadGetFingerprintAttributeType `json:"fingerprint,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateKeyPairPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + Name CreateKeyPairPayloadGetNameAttributeType `json:"name,omitempty"` + // Object that represents a public SSH key. + // REQUIRED + PublicKey CreateKeyPairPayloadGetPublicKeyAttributeType `json:"publicKey" required:"true"` + // Date-time when resource was last updated. + UpdatedAt CreateKeyPairPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateKeyPairPayload CreateKeyPairPayload + +// NewCreateKeyPairPayload instantiates a new CreateKeyPairPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateKeyPairPayload(publicKey CreateKeyPairPayloadGetPublicKeyArgType) *CreateKeyPairPayload { + this := CreateKeyPairPayload{} + setCreateKeyPairPayloadGetPublicKeyAttributeType(&this.PublicKey, publicKey) + return &this +} + +// NewCreateKeyPairPayloadWithDefaults instantiates a new CreateKeyPairPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateKeyPairPayloadWithDefaults() *CreateKeyPairPayload { + this := CreateKeyPairPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetCreatedAt() (res CreateKeyPairPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetCreatedAtOk() (ret CreateKeyPairPayloadGetCreatedAtRetType, ok bool) { + return getCreateKeyPairPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateKeyPairPayload) SetCreatedAt(v CreateKeyPairPayloadGetCreatedAtRetType) { + setCreateKeyPairPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetFingerprint() (res CreateKeyPairPayloadGetFingerprintRetType) { + res, _ = o.GetFingerprintOk() + return +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetFingerprintOk() (ret CreateKeyPairPayloadGetFingerprintRetType, ok bool) { + return getCreateKeyPairPayloadGetFingerprintAttributeTypeOk(o.Fingerprint) +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasFingerprint() bool { + _, ok := o.GetFingerprintOk() + return ok +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *CreateKeyPairPayload) SetFingerprint(v CreateKeyPairPayloadGetFingerprintRetType) { + setCreateKeyPairPayloadGetFingerprintAttributeType(&o.Fingerprint, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetLabels() (res CreateKeyPairPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetLabelsOk() (ret CreateKeyPairPayloadGetLabelsRetType, ok bool) { + return getCreateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateKeyPairPayload) SetLabels(v CreateKeyPairPayloadGetLabelsRetType) { + setCreateKeyPairPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetName() (res CreateKeyPairPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetNameOk() (ret CreateKeyPairPayloadGetNameRetType, ok bool) { + return getCreateKeyPairPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateKeyPairPayload) SetName(v CreateKeyPairPayloadGetNameRetType) { + setCreateKeyPairPayloadGetNameAttributeType(&o.Name, v) +} + +// GetPublicKey returns the PublicKey field value +func (o *CreateKeyPairPayload) GetPublicKey() (ret CreateKeyPairPayloadGetPublicKeyRetType) { + ret, _ = o.GetPublicKeyOk() + return ret +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetPublicKeyOk() (ret CreateKeyPairPayloadGetPublicKeyRetType, ok bool) { + return getCreateKeyPairPayloadGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// SetPublicKey sets field value +func (o *CreateKeyPairPayload) SetPublicKey(v CreateKeyPairPayloadGetPublicKeyRetType) { + setCreateKeyPairPayloadGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateKeyPairPayload) GetUpdatedAt() (res CreateKeyPairPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateKeyPairPayload) GetUpdatedAtOk() (ret CreateKeyPairPayloadGetUpdatedAtRetType, ok bool) { + return getCreateKeyPairPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateKeyPairPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateKeyPairPayload) SetUpdatedAt(v CreateKeyPairPayloadGetUpdatedAtRetType) { + setCreateKeyPairPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateKeyPairPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateKeyPairPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateKeyPairPayloadGetFingerprintAttributeTypeOk(o.Fingerprint); ok { + toSerialize["Fingerprint"] = val + } + if val, ok := getCreateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateKeyPairPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateKeyPairPayloadGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getCreateKeyPairPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateKeyPairPayload struct { + value *CreateKeyPairPayload + isSet bool +} + +func (v NullableCreateKeyPairPayload) Get() *CreateKeyPairPayload { + return v.value +} + +func (v *NullableCreateKeyPairPayload) Set(val *CreateKeyPairPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateKeyPairPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateKeyPairPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateKeyPairPayload(val *CreateKeyPairPayload) *NullableCreateKeyPairPayload { + return &NullableCreateKeyPairPayload{value: val, isSet: true} +} + +func (v NullableCreateKeyPairPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateKeyPairPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_address_family.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_address_family.go new file mode 100644 index 00000000..8c01bd6d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_address_family.go @@ -0,0 +1,174 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAddressFamily type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAddressFamily{} + +/* + types and functions for ipv4 +*/ + +// isModel +type CreateNetworkAddressFamilyGetIpv4AttributeType = *CreateNetworkIPv4Body +type CreateNetworkAddressFamilyGetIpv4ArgType = CreateNetworkIPv4Body +type CreateNetworkAddressFamilyGetIpv4RetType = CreateNetworkIPv4Body + +func getCreateNetworkAddressFamilyGetIpv4AttributeTypeOk(arg CreateNetworkAddressFamilyGetIpv4AttributeType) (ret CreateNetworkAddressFamilyGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAddressFamilyGetIpv4AttributeType(arg *CreateNetworkAddressFamilyGetIpv4AttributeType, val CreateNetworkAddressFamilyGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type CreateNetworkAddressFamilyGetIpv6AttributeType = *CreateNetworkIPv6Body +type CreateNetworkAddressFamilyGetIpv6ArgType = CreateNetworkIPv6Body +type CreateNetworkAddressFamilyGetIpv6RetType = CreateNetworkIPv6Body + +func getCreateNetworkAddressFamilyGetIpv6AttributeTypeOk(arg CreateNetworkAddressFamilyGetIpv6AttributeType) (ret CreateNetworkAddressFamilyGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAddressFamilyGetIpv6AttributeType(arg *CreateNetworkAddressFamilyGetIpv6AttributeType, val CreateNetworkAddressFamilyGetIpv6RetType) { + *arg = &val +} + +// CreateNetworkAddressFamily The addressFamily object for a network create request. +type CreateNetworkAddressFamily struct { + Ipv4 CreateNetworkAddressFamilyGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 CreateNetworkAddressFamilyGetIpv6AttributeType `json:"ipv6,omitempty"` +} + +// NewCreateNetworkAddressFamily instantiates a new CreateNetworkAddressFamily object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkAddressFamily() *CreateNetworkAddressFamily { + this := CreateNetworkAddressFamily{} + return &this +} + +// NewCreateNetworkAddressFamilyWithDefaults instantiates a new CreateNetworkAddressFamily object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkAddressFamilyWithDefaults() *CreateNetworkAddressFamily { + this := CreateNetworkAddressFamily{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNetworkAddressFamily) GetIpv4() (res CreateNetworkAddressFamilyGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAddressFamily) GetIpv4Ok() (ret CreateNetworkAddressFamilyGetIpv4RetType, ok bool) { + return getCreateNetworkAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNetworkAddressFamily) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given CreateNetworkIPv4Body and assigns it to the Ipv4 field. +func (o *CreateNetworkAddressFamily) SetIpv4(v CreateNetworkAddressFamilyGetIpv4RetType) { + setCreateNetworkAddressFamilyGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *CreateNetworkAddressFamily) GetIpv6() (res CreateNetworkAddressFamilyGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAddressFamily) GetIpv6Ok() (ret CreateNetworkAddressFamilyGetIpv6RetType, ok bool) { + return getCreateNetworkAddressFamilyGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *CreateNetworkAddressFamily) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given CreateNetworkIPv6Body and assigns it to the Ipv6 field. +func (o *CreateNetworkAddressFamily) SetIpv6(v CreateNetworkAddressFamilyGetIpv6RetType) { + setCreateNetworkAddressFamilyGetIpv6AttributeType(&o.Ipv6, v) +} + +func (o CreateNetworkAddressFamily) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateNetworkAddressFamilyGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAddressFamily struct { + value *CreateNetworkAddressFamily + isSet bool +} + +func (v NullableCreateNetworkAddressFamily) Get() *CreateNetworkAddressFamily { + return v.value +} + +func (v *NullableCreateNetworkAddressFamily) Set(val *CreateNetworkAddressFamily) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAddressFamily) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAddressFamily) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAddressFamily(val *CreateNetworkAddressFamily) *NullableCreateNetworkAddressFamily { + return &NullableCreateNetworkAddressFamily{value: val, isSet: true} +} + +func (v NullableCreateNetworkAddressFamily) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAddressFamily) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_payload.go new file mode 100644 index 00000000..5d937aa7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_payload.go @@ -0,0 +1,174 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAreaPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateNetworkAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateNetworkAreaPayloadGetLabelsArgType = map[string]interface{} +type CreateNetworkAreaPayloadGetLabelsRetType = map[string]interface{} + +func getCreateNetworkAreaPayloadGetLabelsAttributeTypeOk(arg CreateNetworkAreaPayloadGetLabelsAttributeType) (ret CreateNetworkAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaPayloadGetLabelsAttributeType(arg *CreateNetworkAreaPayloadGetLabelsAttributeType, val CreateNetworkAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateNetworkAreaPayloadGetNameAttributeType = *string + +func getCreateNetworkAreaPayloadGetNameAttributeTypeOk(arg CreateNetworkAreaPayloadGetNameAttributeType) (ret CreateNetworkAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaPayloadGetNameAttributeType(arg *CreateNetworkAreaPayloadGetNameAttributeType, val CreateNetworkAreaPayloadGetNameRetType) { + *arg = &val +} + +type CreateNetworkAreaPayloadGetNameArgType = string +type CreateNetworkAreaPayloadGetNameRetType = string + +// CreateNetworkAreaPayload Object that represents the network area create request. +type CreateNetworkAreaPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateNetworkAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Name CreateNetworkAreaPayloadGetNameAttributeType `json:"name" required:"true"` +} + +type _CreateNetworkAreaPayload CreateNetworkAreaPayload + +// NewCreateNetworkAreaPayload instantiates a new CreateNetworkAreaPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkAreaPayload(name CreateNetworkAreaPayloadGetNameArgType) *CreateNetworkAreaPayload { + this := CreateNetworkAreaPayload{} + setCreateNetworkAreaPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateNetworkAreaPayloadWithDefaults instantiates a new CreateNetworkAreaPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkAreaPayloadWithDefaults() *CreateNetworkAreaPayload { + this := CreateNetworkAreaPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateNetworkAreaPayload) GetLabels() (res CreateNetworkAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaPayload) GetLabelsOk() (ret CreateNetworkAreaPayloadGetLabelsRetType, ok bool) { + return getCreateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateNetworkAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateNetworkAreaPayload) SetLabels(v CreateNetworkAreaPayloadGetLabelsRetType) { + setCreateNetworkAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateNetworkAreaPayload) GetName() (ret CreateNetworkAreaPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaPayload) GetNameOk() (ret CreateNetworkAreaPayloadGetNameRetType, ok bool) { + return getCreateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateNetworkAreaPayload) SetName(v CreateNetworkAreaPayloadGetNameRetType) { + setCreateNetworkAreaPayloadGetNameAttributeType(&o.Name, v) +} + +func (o CreateNetworkAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAreaPayload struct { + value *CreateNetworkAreaPayload + isSet bool +} + +func (v NullableCreateNetworkAreaPayload) Get() *CreateNetworkAreaPayload { + return v.value +} + +func (v *NullableCreateNetworkAreaPayload) Set(val *CreateNetworkAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAreaPayload(val *CreateNetworkAreaPayload) *NullableCreateNetworkAreaPayload { + return &NullableCreateNetworkAreaPayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_range_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_range_payload.go new file mode 100644 index 00000000..fcf47281 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_range_payload.go @@ -0,0 +1,128 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAreaRangePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAreaRangePayload{} + +/* + types and functions for ipv4 +*/ + +// isArray +type CreateNetworkAreaRangePayloadGetIpv4AttributeType = *[]NetworkRange +type CreateNetworkAreaRangePayloadGetIpv4ArgType = []NetworkRange +type CreateNetworkAreaRangePayloadGetIpv4RetType = []NetworkRange + +func getCreateNetworkAreaRangePayloadGetIpv4AttributeTypeOk(arg CreateNetworkAreaRangePayloadGetIpv4AttributeType) (ret CreateNetworkAreaRangePayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaRangePayloadGetIpv4AttributeType(arg *CreateNetworkAreaRangePayloadGetIpv4AttributeType, val CreateNetworkAreaRangePayloadGetIpv4RetType) { + *arg = &val +} + +// CreateNetworkAreaRangePayload struct for CreateNetworkAreaRangePayload +type CreateNetworkAreaRangePayload struct { + // A list of network ranges. + Ipv4 CreateNetworkAreaRangePayloadGetIpv4AttributeType `json:"ipv4,omitempty"` +} + +// NewCreateNetworkAreaRangePayload instantiates a new CreateNetworkAreaRangePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkAreaRangePayload() *CreateNetworkAreaRangePayload { + this := CreateNetworkAreaRangePayload{} + return &this +} + +// NewCreateNetworkAreaRangePayloadWithDefaults instantiates a new CreateNetworkAreaRangePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkAreaRangePayloadWithDefaults() *CreateNetworkAreaRangePayload { + this := CreateNetworkAreaRangePayload{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNetworkAreaRangePayload) GetIpv4() (res CreateNetworkAreaRangePayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaRangePayload) GetIpv4Ok() (ret CreateNetworkAreaRangePayloadGetIpv4RetType, ok bool) { + return getCreateNetworkAreaRangePayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNetworkAreaRangePayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given []NetworkRange and assigns it to the Ipv4 field. +func (o *CreateNetworkAreaRangePayload) SetIpv4(v CreateNetworkAreaRangePayloadGetIpv4RetType) { + setCreateNetworkAreaRangePayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +func (o CreateNetworkAreaRangePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAreaRangePayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAreaRangePayload struct { + value *CreateNetworkAreaRangePayload + isSet bool +} + +func (v NullableCreateNetworkAreaRangePayload) Get() *CreateNetworkAreaRangePayload { + return v.value +} + +func (v *NullableCreateNetworkAreaRangePayload) Set(val *CreateNetworkAreaRangePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAreaRangePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAreaRangePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAreaRangePayload(val *CreateNetworkAreaRangePayload) *NullableCreateNetworkAreaRangePayload { + return &NullableCreateNetworkAreaRangePayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkAreaRangePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAreaRangePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_region_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_region_payload.go new file mode 100644 index 00000000..72dd340b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_region_payload.go @@ -0,0 +1,176 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAreaRegionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAreaRegionPayload{} + +/* + types and functions for ipv4 +*/ + +// isModel +type CreateNetworkAreaRegionPayloadGetIpv4AttributeType = *RegionalAreaIPv4 +type CreateNetworkAreaRegionPayloadGetIpv4ArgType = RegionalAreaIPv4 +type CreateNetworkAreaRegionPayloadGetIpv4RetType = RegionalAreaIPv4 + +func getCreateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(arg CreateNetworkAreaRegionPayloadGetIpv4AttributeType) (ret CreateNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaRegionPayloadGetIpv4AttributeType(arg *CreateNetworkAreaRegionPayloadGetIpv4AttributeType, val CreateNetworkAreaRegionPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateNetworkAreaRegionPayloadGetStatusAttributeType = *string + +func getCreateNetworkAreaRegionPayloadGetStatusAttributeTypeOk(arg CreateNetworkAreaRegionPayloadGetStatusAttributeType) (ret CreateNetworkAreaRegionPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaRegionPayloadGetStatusAttributeType(arg *CreateNetworkAreaRegionPayloadGetStatusAttributeType, val CreateNetworkAreaRegionPayloadGetStatusRetType) { + *arg = &val +} + +type CreateNetworkAreaRegionPayloadGetStatusArgType = string +type CreateNetworkAreaRegionPayloadGetStatusRetType = string + +// CreateNetworkAreaRegionPayload The basic properties of a regional network area. +type CreateNetworkAreaRegionPayload struct { + Ipv4 CreateNetworkAreaRegionPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + Status CreateNetworkAreaRegionPayloadGetStatusAttributeType `json:"status,omitempty"` +} + +// NewCreateNetworkAreaRegionPayload instantiates a new CreateNetworkAreaRegionPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkAreaRegionPayload() *CreateNetworkAreaRegionPayload { + this := CreateNetworkAreaRegionPayload{} + return &this +} + +// NewCreateNetworkAreaRegionPayloadWithDefaults instantiates a new CreateNetworkAreaRegionPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkAreaRegionPayloadWithDefaults() *CreateNetworkAreaRegionPayload { + this := CreateNetworkAreaRegionPayload{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNetworkAreaRegionPayload) GetIpv4() (res CreateNetworkAreaRegionPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaRegionPayload) GetIpv4Ok() (ret CreateNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + return getCreateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNetworkAreaRegionPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given RegionalAreaIPv4 and assigns it to the Ipv4 field. +func (o *CreateNetworkAreaRegionPayload) SetIpv4(v CreateNetworkAreaRegionPayloadGetIpv4RetType) { + setCreateNetworkAreaRegionPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateNetworkAreaRegionPayload) GetStatus() (res CreateNetworkAreaRegionPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaRegionPayload) GetStatusOk() (ret CreateNetworkAreaRegionPayloadGetStatusRetType, ok bool) { + return getCreateNetworkAreaRegionPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateNetworkAreaRegionPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateNetworkAreaRegionPayload) SetStatus(v CreateNetworkAreaRegionPayloadGetStatusRetType) { + setCreateNetworkAreaRegionPayloadGetStatusAttributeType(&o.Status, v) +} + +func (o CreateNetworkAreaRegionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateNetworkAreaRegionPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAreaRegionPayload struct { + value *CreateNetworkAreaRegionPayload + isSet bool +} + +func (v NullableCreateNetworkAreaRegionPayload) Get() *CreateNetworkAreaRegionPayload { + return v.value +} + +func (v *NullableCreateNetworkAreaRegionPayload) Set(val *CreateNetworkAreaRegionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAreaRegionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAreaRegionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAreaRegionPayload(val *CreateNetworkAreaRegionPayload) *NullableCreateNetworkAreaRegionPayload { + return &NullableCreateNetworkAreaRegionPayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkAreaRegionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAreaRegionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_route_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_route_payload.go new file mode 100644 index 00000000..8f3c3f33 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_area_route_payload.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkAreaRoutePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkAreaRoutePayload{} + +/* + types and functions for items +*/ + +// isArray +type CreateNetworkAreaRoutePayloadGetItemsAttributeType = *[]Route +type CreateNetworkAreaRoutePayloadGetItemsArgType = []Route +type CreateNetworkAreaRoutePayloadGetItemsRetType = []Route + +func getCreateNetworkAreaRoutePayloadGetItemsAttributeTypeOk(arg CreateNetworkAreaRoutePayloadGetItemsAttributeType) (ret CreateNetworkAreaRoutePayloadGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkAreaRoutePayloadGetItemsAttributeType(arg *CreateNetworkAreaRoutePayloadGetItemsAttributeType, val CreateNetworkAreaRoutePayloadGetItemsRetType) { + *arg = &val +} + +// CreateNetworkAreaRoutePayload Object represents a request to add network routes. +type CreateNetworkAreaRoutePayload struct { + // A list of routes. + // REQUIRED + Items CreateNetworkAreaRoutePayloadGetItemsAttributeType `json:"items" required:"true"` +} + +type _CreateNetworkAreaRoutePayload CreateNetworkAreaRoutePayload + +// NewCreateNetworkAreaRoutePayload instantiates a new CreateNetworkAreaRoutePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkAreaRoutePayload(items CreateNetworkAreaRoutePayloadGetItemsArgType) *CreateNetworkAreaRoutePayload { + this := CreateNetworkAreaRoutePayload{} + setCreateNetworkAreaRoutePayloadGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewCreateNetworkAreaRoutePayloadWithDefaults instantiates a new CreateNetworkAreaRoutePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkAreaRoutePayloadWithDefaults() *CreateNetworkAreaRoutePayload { + this := CreateNetworkAreaRoutePayload{} + return &this +} + +// GetItems returns the Items field value +func (o *CreateNetworkAreaRoutePayload) GetItems() (ret CreateNetworkAreaRoutePayloadGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkAreaRoutePayload) GetItemsOk() (ret CreateNetworkAreaRoutePayloadGetItemsRetType, ok bool) { + return getCreateNetworkAreaRoutePayloadGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *CreateNetworkAreaRoutePayload) SetItems(v CreateNetworkAreaRoutePayloadGetItemsRetType) { + setCreateNetworkAreaRoutePayloadGetItemsAttributeType(&o.Items, v) +} + +func (o CreateNetworkAreaRoutePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkAreaRoutePayloadGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkAreaRoutePayload struct { + value *CreateNetworkAreaRoutePayload + isSet bool +} + +func (v NullableCreateNetworkAreaRoutePayload) Get() *CreateNetworkAreaRoutePayload { + return v.value +} + +func (v *NullableCreateNetworkAreaRoutePayload) Set(val *CreateNetworkAreaRoutePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkAreaRoutePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkAreaRoutePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkAreaRoutePayload(val *CreateNetworkAreaRoutePayload) *NullableCreateNetworkAreaRoutePayload { + return &NullableCreateNetworkAreaRoutePayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkAreaRoutePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkAreaRoutePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4.go new file mode 100644 index 00000000..a169d5c5 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4.go @@ -0,0 +1,144 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// CreateNetworkIPv4 - The create request for an IPv4 network. +type CreateNetworkIPv4 struct { + CreateNetworkIPv4WithPrefix *CreateNetworkIPv4WithPrefix + CreateNetworkIPv4WithPrefixLength *CreateNetworkIPv4WithPrefixLength +} + +// CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefix wrapped in CreateNetworkIPv4 +func CreateNetworkIPv4WithPrefixAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefix) CreateNetworkIPv4 { + return CreateNetworkIPv4{ + CreateNetworkIPv4WithPrefix: v, + } +} + +// CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4 is a convenience function that returns CreateNetworkIPv4WithPrefixLength wrapped in CreateNetworkIPv4 +func CreateNetworkIPv4WithPrefixLengthAsCreateNetworkIPv4(v *CreateNetworkIPv4WithPrefixLength) CreateNetworkIPv4 { + return CreateNetworkIPv4{ + CreateNetworkIPv4WithPrefixLength: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateNetworkIPv4) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateNetworkIPv4WithPrefix + dstCreateNetworkIPv41 := &CreateNetworkIPv4{} + err = json.Unmarshal(data, &dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix) + if err == nil { + jsonCreateNetworkIPv4WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix) + if string(jsonCreateNetworkIPv4WithPrefix) != "{}" { // empty struct + dst.CreateNetworkIPv4WithPrefix = dstCreateNetworkIPv41.CreateNetworkIPv4WithPrefix + match++ + } + } + + // try to unmarshal data into CreateNetworkIPv4WithPrefixLength + dstCreateNetworkIPv42 := &CreateNetworkIPv4{} + err = json.Unmarshal(data, &dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength) + if err == nil { + jsonCreateNetworkIPv4WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength) + if string(jsonCreateNetworkIPv4WithPrefixLength) != "{}" { // empty struct + dst.CreateNetworkIPv4WithPrefixLength = dstCreateNetworkIPv42.CreateNetworkIPv4WithPrefixLength + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateNetworkIPv4WithPrefix = nil + dst.CreateNetworkIPv4WithPrefixLength = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv4)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv4)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateNetworkIPv4) MarshalJSON() ([]byte, error) { + if src.CreateNetworkIPv4WithPrefix != nil { + return json.Marshal(&src.CreateNetworkIPv4WithPrefix) + } + + if src.CreateNetworkIPv4WithPrefixLength != nil { + return json.Marshal(&src.CreateNetworkIPv4WithPrefixLength) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateNetworkIPv4) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateNetworkIPv4WithPrefix != nil { + return obj.CreateNetworkIPv4WithPrefix + } + + if obj.CreateNetworkIPv4WithPrefixLength != nil { + return obj.CreateNetworkIPv4WithPrefixLength + } + + // all schemas are nil + return nil +} + +type NullableCreateNetworkIPv4 struct { + value *CreateNetworkIPv4 + isSet bool +} + +func (v NullableCreateNetworkIPv4) Get() *CreateNetworkIPv4 { + return v.value +} + +func (v *NullableCreateNetworkIPv4) Set(val *CreateNetworkIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4(val *CreateNetworkIPv4) *NullableCreateNetworkIPv4 { + return &NullableCreateNetworkIPv4{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_body.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_body.go new file mode 100644 index 00000000..31ce1ded --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_body.go @@ -0,0 +1,288 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv4Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv4Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv4BodyGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv4BodyGetGatewayAttributeTypeOk(arg CreateNetworkIPv4BodyGetGatewayAttributeType) (ret CreateNetworkIPv4BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv4BodyGetGatewayAttributeType(arg *CreateNetworkIPv4BodyGetGatewayAttributeType, val CreateNetworkIPv4BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv4BodyGetGatewayArgType = *string +type CreateNetworkIPv4BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv4BodyGetNameserversAttributeType = *[]string +type CreateNetworkIPv4BodyGetNameserversArgType = []string +type CreateNetworkIPv4BodyGetNameserversRetType = []string + +func getCreateNetworkIPv4BodyGetNameserversAttributeTypeOk(arg CreateNetworkIPv4BodyGetNameserversAttributeType) (ret CreateNetworkIPv4BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4BodyGetNameserversAttributeType(arg *CreateNetworkIPv4BodyGetNameserversAttributeType, val CreateNetworkIPv4BodyGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv4BodyGetPrefixAttributeType = *string + +func getCreateNetworkIPv4BodyGetPrefixAttributeTypeOk(arg CreateNetworkIPv4BodyGetPrefixAttributeType) (ret CreateNetworkIPv4BodyGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4BodyGetPrefixAttributeType(arg *CreateNetworkIPv4BodyGetPrefixAttributeType, val CreateNetworkIPv4BodyGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv4BodyGetPrefixArgType = string +type CreateNetworkIPv4BodyGetPrefixRetType = string + +/* + types and functions for prefixLength +*/ + +// isInteger +type CreateNetworkIPv4BodyGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv4BodyGetPrefixLengthArgType = int64 +type CreateNetworkIPv4BodyGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv4BodyGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv4BodyGetPrefixLengthAttributeType) (ret CreateNetworkIPv4BodyGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4BodyGetPrefixLengthAttributeType(arg *CreateNetworkIPv4BodyGetPrefixLengthAttributeType, val CreateNetworkIPv4BodyGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv4Body The config object for an IPv4 network. +type CreateNetworkIPv4Body struct { + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv4BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers CreateNetworkIPv4BodyGetNameserversAttributeType `json:"nameservers,omitempty"` + // Classless Inter-Domain Routing (CIDR). + Prefix CreateNetworkIPv4BodyGetPrefixAttributeType `json:"prefix,omitempty"` + PrefixLength CreateNetworkIPv4BodyGetPrefixLengthAttributeType `json:"prefixLength,omitempty"` +} + +// NewCreateNetworkIPv4Body instantiates a new CreateNetworkIPv4Body object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkIPv4Body() *CreateNetworkIPv4Body { + this := CreateNetworkIPv4Body{} + return &this +} + +// NewCreateNetworkIPv4BodyWithDefaults instantiates a new CreateNetworkIPv4Body object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkIPv4BodyWithDefaults() *CreateNetworkIPv4Body { + this := CreateNetworkIPv4Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv4Body) GetGateway() (res CreateNetworkIPv4BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv4Body) GetGatewayOk() (ret CreateNetworkIPv4BodyGetGatewayRetType, ok bool) { + return getCreateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv4Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv4Body) SetGateway(v CreateNetworkIPv4BodyGetGatewayRetType) { + setCreateNetworkIPv4BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv4Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv4Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv4Body) GetNameservers() (res CreateNetworkIPv4BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4Body) GetNameserversOk() (ret CreateNetworkIPv4BodyGetNameserversRetType, ok bool) { + return getCreateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv4Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv4Body) SetNameservers(v CreateNetworkIPv4BodyGetNameserversRetType) { + setCreateNetworkIPv4BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *CreateNetworkIPv4Body) GetPrefix() (res CreateNetworkIPv4BodyGetPrefixRetType) { + res, _ = o.GetPrefixOk() + return +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4Body) GetPrefixOk() (ret CreateNetworkIPv4BodyGetPrefixRetType, ok bool) { + return getCreateNetworkIPv4BodyGetPrefixAttributeTypeOk(o.Prefix) +} + +// HasPrefix returns a boolean if a field has been set. +func (o *CreateNetworkIPv4Body) HasPrefix() bool { + _, ok := o.GetPrefixOk() + return ok +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *CreateNetworkIPv4Body) SetPrefix(v CreateNetworkIPv4BodyGetPrefixRetType) { + setCreateNetworkIPv4BodyGetPrefixAttributeType(&o.Prefix, v) +} + +// GetPrefixLength returns the PrefixLength field value if set, zero value otherwise. +func (o *CreateNetworkIPv4Body) GetPrefixLength() (res CreateNetworkIPv4BodyGetPrefixLengthRetType) { + res, _ = o.GetPrefixLengthOk() + return +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4Body) GetPrefixLengthOk() (ret CreateNetworkIPv4BodyGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv4BodyGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// HasPrefixLength returns a boolean if a field has been set. +func (o *CreateNetworkIPv4Body) HasPrefixLength() bool { + _, ok := o.GetPrefixLengthOk() + return ok +} + +// SetPrefixLength gets a reference to the given int64 and assigns it to the PrefixLength field. +func (o *CreateNetworkIPv4Body) SetPrefixLength(v CreateNetworkIPv4BodyGetPrefixLengthRetType) { + setCreateNetworkIPv4BodyGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv4Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv4BodyGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + if val, ok := getCreateNetworkIPv4BodyGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv4Body struct { + value *CreateNetworkIPv4Body + isSet bool +} + +func (v NullableCreateNetworkIPv4Body) Get() *CreateNetworkIPv4Body { + return v.value +} + +func (v *NullableCreateNetworkIPv4Body) Set(val *CreateNetworkIPv4Body) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4Body) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4Body(val *CreateNetworkIPv4Body) *NullableCreateNetworkIPv4Body { + return &NullableCreateNetworkIPv4Body{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_with_prefix.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_with_prefix.go new file mode 100644 index 00000000..a5749177 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_with_prefix.go @@ -0,0 +1,239 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv4WithPrefix type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv4WithPrefix{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv4WithPrefixGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv4WithPrefixGetGatewayAttributeType, val CreateNetworkIPv4WithPrefixGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv4WithPrefixGetGatewayArgType = *string +type CreateNetworkIPv4WithPrefixGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv4WithPrefixGetNameserversAttributeType = *[]string +type CreateNetworkIPv4WithPrefixGetNameserversArgType = []string +type CreateNetworkIPv4WithPrefixGetNameserversRetType = []string + +func getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv4WithPrefixGetPrefixAttributeType = *string + +func getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv4WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv4WithPrefixGetPrefixAttributeType, val CreateNetworkIPv4WithPrefixGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv4WithPrefixGetPrefixArgType = string +type CreateNetworkIPv4WithPrefixGetPrefixRetType = string + +// CreateNetworkIPv4WithPrefix The create request for an IPv4 network with a specified prefix. +type CreateNetworkIPv4WithPrefix struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv4WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers CreateNetworkIPv4WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"` + // IPv4 Classless Inter-Domain Routing (CIDR). + // REQUIRED + Prefix CreateNetworkIPv4WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"` +} + +type _CreateNetworkIPv4WithPrefix CreateNetworkIPv4WithPrefix + +// NewCreateNetworkIPv4WithPrefix instantiates a new CreateNetworkIPv4WithPrefix object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkIPv4WithPrefix(prefix CreateNetworkIPv4WithPrefixGetPrefixArgType) *CreateNetworkIPv4WithPrefix { + this := CreateNetworkIPv4WithPrefix{} + setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewCreateNetworkIPv4WithPrefixWithDefaults instantiates a new CreateNetworkIPv4WithPrefix object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkIPv4WithPrefixWithDefaults() *CreateNetworkIPv4WithPrefix { + this := CreateNetworkIPv4WithPrefix{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv4WithPrefix) GetGateway() (res CreateNetworkIPv4WithPrefixGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv4WithPrefix) GetGatewayOk() (ret CreateNetworkIPv4WithPrefixGetGatewayRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefix) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv4WithPrefix) SetGateway(v CreateNetworkIPv4WithPrefixGetGatewayRetType) { + setCreateNetworkIPv4WithPrefixGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv4WithPrefix) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv4WithPrefix) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv4WithPrefix) GetNameservers() (res CreateNetworkIPv4WithPrefixGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefix) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixGetNameserversRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefix) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv4WithPrefix) SetNameservers(v CreateNetworkIPv4WithPrefixGetNameserversRetType) { + setCreateNetworkIPv4WithPrefixGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value +func (o *CreateNetworkIPv4WithPrefix) GetPrefix() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefix) GetPrefixOk() (ret CreateNetworkIPv4WithPrefixGetPrefixRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *CreateNetworkIPv4WithPrefix) SetPrefix(v CreateNetworkIPv4WithPrefixGetPrefixRetType) { + setCreateNetworkIPv4WithPrefixGetPrefixAttributeType(&o.Prefix, v) +} + +func (o CreateNetworkIPv4WithPrefix) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv4WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv4WithPrefix struct { + value *CreateNetworkIPv4WithPrefix + isSet bool +} + +func (v NullableCreateNetworkIPv4WithPrefix) Get() *CreateNetworkIPv4WithPrefix { + return v.value +} + +func (v *NullableCreateNetworkIPv4WithPrefix) Set(val *CreateNetworkIPv4WithPrefix) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4WithPrefix) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4WithPrefix) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4WithPrefix(val *CreateNetworkIPv4WithPrefix) *NullableCreateNetworkIPv4WithPrefix { + return &NullableCreateNetworkIPv4WithPrefix{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4WithPrefix) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4WithPrefix) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_with_prefix_length.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_with_prefix_length.go new file mode 100644 index 00000000..f9bc05ef --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv4_with_prefix_length.go @@ -0,0 +1,173 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv4WithPrefixLength type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv4WithPrefixLength{} + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType = *[]string +type CreateNetworkIPv4WithPrefixLengthGetNameserversArgType = []string +type CreateNetworkIPv4WithPrefixLengthGetNameserversRetType = []string + +func getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixLength +*/ + +// isLong +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType = int64 +type CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv4WithPrefixLength The create request for an IPv4 network with a wanted prefix length. +type CreateNetworkIPv4WithPrefixLength struct { + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers CreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + PrefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"` +} + +type _CreateNetworkIPv4WithPrefixLength CreateNetworkIPv4WithPrefixLength + +// NewCreateNetworkIPv4WithPrefixLength instantiates a new CreateNetworkIPv4WithPrefixLength object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkIPv4WithPrefixLength(prefixLength CreateNetworkIPv4WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv4WithPrefixLength { + this := CreateNetworkIPv4WithPrefixLength{} + setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength) + return &this +} + +// NewCreateNetworkIPv4WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv4WithPrefixLength object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkIPv4WithPrefixLengthWithDefaults() *CreateNetworkIPv4WithPrefixLength { + this := CreateNetworkIPv4WithPrefixLength{} + return &this +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv4WithPrefixLength) GetNameservers() (res CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv4WithPrefixLengthGetNameserversRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv4WithPrefixLength) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv4WithPrefixLength) SetNameservers(v CreateNetworkIPv4WithPrefixLengthGetNameserversRetType) { + setCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixLength returns the PrefixLength field value +func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + ret, _ = o.GetPrefixLengthOk() + return ret +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv4WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// SetPrefixLength sets field value +func (o *CreateNetworkIPv4WithPrefixLength) SetPrefixLength(v CreateNetworkIPv4WithPrefixLengthGetPrefixLengthRetType) { + setCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv4WithPrefixLength) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv4WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv4WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv4WithPrefixLength struct { + value *CreateNetworkIPv4WithPrefixLength + isSet bool +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) Get() *CreateNetworkIPv4WithPrefixLength { + return v.value +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) Set(val *CreateNetworkIPv4WithPrefixLength) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv4WithPrefixLength(val *CreateNetworkIPv4WithPrefixLength) *NullableCreateNetworkIPv4WithPrefixLength { + return &NullableCreateNetworkIPv4WithPrefixLength{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv4WithPrefixLength) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv4WithPrefixLength) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6.go new file mode 100644 index 00000000..18d22851 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6.go @@ -0,0 +1,144 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// CreateNetworkIPv6 - The create request for an IPv6 network. +type CreateNetworkIPv6 struct { + CreateNetworkIPv6WithPrefix *CreateNetworkIPv6WithPrefix + CreateNetworkIPv6WithPrefixLength *CreateNetworkIPv6WithPrefixLength +} + +// CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefix wrapped in CreateNetworkIPv6 +func CreateNetworkIPv6WithPrefixAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefix) CreateNetworkIPv6 { + return CreateNetworkIPv6{ + CreateNetworkIPv6WithPrefix: v, + } +} + +// CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6 is a convenience function that returns CreateNetworkIPv6WithPrefixLength wrapped in CreateNetworkIPv6 +func CreateNetworkIPv6WithPrefixLengthAsCreateNetworkIPv6(v *CreateNetworkIPv6WithPrefixLength) CreateNetworkIPv6 { + return CreateNetworkIPv6{ + CreateNetworkIPv6WithPrefixLength: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateNetworkIPv6) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateNetworkIPv6WithPrefix + dstCreateNetworkIPv61 := &CreateNetworkIPv6{} + err = json.Unmarshal(data, &dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix) + if err == nil { + jsonCreateNetworkIPv6WithPrefix, _ := json.Marshal(&dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix) + if string(jsonCreateNetworkIPv6WithPrefix) != "{}" { // empty struct + dst.CreateNetworkIPv6WithPrefix = dstCreateNetworkIPv61.CreateNetworkIPv6WithPrefix + match++ + } + } + + // try to unmarshal data into CreateNetworkIPv6WithPrefixLength + dstCreateNetworkIPv62 := &CreateNetworkIPv6{} + err = json.Unmarshal(data, &dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength) + if err == nil { + jsonCreateNetworkIPv6WithPrefixLength, _ := json.Marshal(&dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength) + if string(jsonCreateNetworkIPv6WithPrefixLength) != "{}" { // empty struct + dst.CreateNetworkIPv6WithPrefixLength = dstCreateNetworkIPv62.CreateNetworkIPv6WithPrefixLength + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateNetworkIPv6WithPrefix = nil + dst.CreateNetworkIPv6WithPrefixLength = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateNetworkIPv6)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateNetworkIPv6)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateNetworkIPv6) MarshalJSON() ([]byte, error) { + if src.CreateNetworkIPv6WithPrefix != nil { + return json.Marshal(&src.CreateNetworkIPv6WithPrefix) + } + + if src.CreateNetworkIPv6WithPrefixLength != nil { + return json.Marshal(&src.CreateNetworkIPv6WithPrefixLength) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateNetworkIPv6) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateNetworkIPv6WithPrefix != nil { + return obj.CreateNetworkIPv6WithPrefix + } + + if obj.CreateNetworkIPv6WithPrefixLength != nil { + return obj.CreateNetworkIPv6WithPrefixLength + } + + // all schemas are nil + return nil +} + +type NullableCreateNetworkIPv6 struct { + value *CreateNetworkIPv6 + isSet bool +} + +func (v NullableCreateNetworkIPv6) Get() *CreateNetworkIPv6 { + return v.value +} + +func (v *NullableCreateNetworkIPv6) Set(val *CreateNetworkIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6(val *CreateNetworkIPv6) *NullableCreateNetworkIPv6 { + return &NullableCreateNetworkIPv6{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_body.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_body.go new file mode 100644 index 00000000..a91f9cfc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_body.go @@ -0,0 +1,288 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv6Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv6Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv6BodyGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv6BodyGetGatewayAttributeTypeOk(arg CreateNetworkIPv6BodyGetGatewayAttributeType) (ret CreateNetworkIPv6BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv6BodyGetGatewayAttributeType(arg *CreateNetworkIPv6BodyGetGatewayAttributeType, val CreateNetworkIPv6BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv6BodyGetGatewayArgType = *string +type CreateNetworkIPv6BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv6BodyGetNameserversAttributeType = *[]string +type CreateNetworkIPv6BodyGetNameserversArgType = []string +type CreateNetworkIPv6BodyGetNameserversRetType = []string + +func getCreateNetworkIPv6BodyGetNameserversAttributeTypeOk(arg CreateNetworkIPv6BodyGetNameserversAttributeType) (ret CreateNetworkIPv6BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6BodyGetNameserversAttributeType(arg *CreateNetworkIPv6BodyGetNameserversAttributeType, val CreateNetworkIPv6BodyGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv6BodyGetPrefixAttributeType = *string + +func getCreateNetworkIPv6BodyGetPrefixAttributeTypeOk(arg CreateNetworkIPv6BodyGetPrefixAttributeType) (ret CreateNetworkIPv6BodyGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6BodyGetPrefixAttributeType(arg *CreateNetworkIPv6BodyGetPrefixAttributeType, val CreateNetworkIPv6BodyGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv6BodyGetPrefixArgType = string +type CreateNetworkIPv6BodyGetPrefixRetType = string + +/* + types and functions for prefixLength +*/ + +// isInteger +type CreateNetworkIPv6BodyGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv6BodyGetPrefixLengthArgType = int64 +type CreateNetworkIPv6BodyGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv6BodyGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv6BodyGetPrefixLengthAttributeType) (ret CreateNetworkIPv6BodyGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6BodyGetPrefixLengthAttributeType(arg *CreateNetworkIPv6BodyGetPrefixLengthAttributeType, val CreateNetworkIPv6BodyGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv6Body The config object for an IPv6 network. +type CreateNetworkIPv6Body struct { + // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv6BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers CreateNetworkIPv6BodyGetNameserversAttributeType `json:"nameservers,omitempty"` + // Classless Inter-Domain Routing (CIDR) for IPv6. + Prefix CreateNetworkIPv6BodyGetPrefixAttributeType `json:"prefix,omitempty"` + PrefixLength CreateNetworkIPv6BodyGetPrefixLengthAttributeType `json:"prefixLength,omitempty"` +} + +// NewCreateNetworkIPv6Body instantiates a new CreateNetworkIPv6Body object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkIPv6Body() *CreateNetworkIPv6Body { + this := CreateNetworkIPv6Body{} + return &this +} + +// NewCreateNetworkIPv6BodyWithDefaults instantiates a new CreateNetworkIPv6Body object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkIPv6BodyWithDefaults() *CreateNetworkIPv6Body { + this := CreateNetworkIPv6Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv6Body) GetGateway() (res CreateNetworkIPv6BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv6Body) GetGatewayOk() (ret CreateNetworkIPv6BodyGetGatewayRetType, ok bool) { + return getCreateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv6Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv6Body) SetGateway(v CreateNetworkIPv6BodyGetGatewayRetType) { + setCreateNetworkIPv6BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv6Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv6Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv6Body) GetNameservers() (res CreateNetworkIPv6BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6Body) GetNameserversOk() (ret CreateNetworkIPv6BodyGetNameserversRetType, ok bool) { + return getCreateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv6Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv6Body) SetNameservers(v CreateNetworkIPv6BodyGetNameserversRetType) { + setCreateNetworkIPv6BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value if set, zero value otherwise. +func (o *CreateNetworkIPv6Body) GetPrefix() (res CreateNetworkIPv6BodyGetPrefixRetType) { + res, _ = o.GetPrefixOk() + return +} + +// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6Body) GetPrefixOk() (ret CreateNetworkIPv6BodyGetPrefixRetType, ok bool) { + return getCreateNetworkIPv6BodyGetPrefixAttributeTypeOk(o.Prefix) +} + +// HasPrefix returns a boolean if a field has been set. +func (o *CreateNetworkIPv6Body) HasPrefix() bool { + _, ok := o.GetPrefixOk() + return ok +} + +// SetPrefix gets a reference to the given string and assigns it to the Prefix field. +func (o *CreateNetworkIPv6Body) SetPrefix(v CreateNetworkIPv6BodyGetPrefixRetType) { + setCreateNetworkIPv6BodyGetPrefixAttributeType(&o.Prefix, v) +} + +// GetPrefixLength returns the PrefixLength field value if set, zero value otherwise. +func (o *CreateNetworkIPv6Body) GetPrefixLength() (res CreateNetworkIPv6BodyGetPrefixLengthRetType) { + res, _ = o.GetPrefixLengthOk() + return +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6Body) GetPrefixLengthOk() (ret CreateNetworkIPv6BodyGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv6BodyGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// HasPrefixLength returns a boolean if a field has been set. +func (o *CreateNetworkIPv6Body) HasPrefixLength() bool { + _, ok := o.GetPrefixLengthOk() + return ok +} + +// SetPrefixLength gets a reference to the given int64 and assigns it to the PrefixLength field. +func (o *CreateNetworkIPv6Body) SetPrefixLength(v CreateNetworkIPv6BodyGetPrefixLengthRetType) { + setCreateNetworkIPv6BodyGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv6Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv6BodyGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + if val, ok := getCreateNetworkIPv6BodyGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv6Body struct { + value *CreateNetworkIPv6Body + isSet bool +} + +func (v NullableCreateNetworkIPv6Body) Get() *CreateNetworkIPv6Body { + return v.value +} + +func (v *NullableCreateNetworkIPv6Body) Set(val *CreateNetworkIPv6Body) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6Body) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6Body(val *CreateNetworkIPv6Body) *NullableCreateNetworkIPv6Body { + return &NullableCreateNetworkIPv6Body{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_with_prefix.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_with_prefix.go new file mode 100644 index 00000000..a3328308 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_with_prefix.go @@ -0,0 +1,239 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv6WithPrefix type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv6WithPrefix{} + +/* + types and functions for gateway +*/ + +// isNullableString +type CreateNetworkIPv6WithPrefixGetGatewayAttributeType = *NullableString + +func getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetGatewayAttributeType) (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(arg *CreateNetworkIPv6WithPrefixGetGatewayAttributeType, val CreateNetworkIPv6WithPrefixGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreateNetworkIPv6WithPrefixGetGatewayArgType = *string +type CreateNetworkIPv6WithPrefixGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv6WithPrefixGetNameserversAttributeType = *[]string +type CreateNetworkIPv6WithPrefixGetNameserversArgType = []string +type CreateNetworkIPv6WithPrefixGetNameserversRetType = []string + +func getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefix +*/ + +// isNotNullableString +type CreateNetworkIPv6WithPrefixGetPrefixAttributeType = *string + +func getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(arg CreateNetworkIPv6WithPrefixGetPrefixAttributeType) (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(arg *CreateNetworkIPv6WithPrefixGetPrefixAttributeType, val CreateNetworkIPv6WithPrefixGetPrefixRetType) { + *arg = &val +} + +type CreateNetworkIPv6WithPrefixGetPrefixArgType = string +type CreateNetworkIPv6WithPrefixGetPrefixRetType = string + +// CreateNetworkIPv6WithPrefix The create request for an IPv6 network with a specified prefix. +type CreateNetworkIPv6WithPrefix struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway CreateNetworkIPv6WithPrefixGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers CreateNetworkIPv6WithPrefixGetNameserversAttributeType `json:"nameservers,omitempty"` + // Classless Inter-Domain Routing (CIDR) for IPv6. + // REQUIRED + Prefix CreateNetworkIPv6WithPrefixGetPrefixAttributeType `json:"prefix" required:"true"` +} + +type _CreateNetworkIPv6WithPrefix CreateNetworkIPv6WithPrefix + +// NewCreateNetworkIPv6WithPrefix instantiates a new CreateNetworkIPv6WithPrefix object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkIPv6WithPrefix(prefix CreateNetworkIPv6WithPrefixGetPrefixArgType) *CreateNetworkIPv6WithPrefix { + this := CreateNetworkIPv6WithPrefix{} + setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewCreateNetworkIPv6WithPrefixWithDefaults instantiates a new CreateNetworkIPv6WithPrefix object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkIPv6WithPrefixWithDefaults() *CreateNetworkIPv6WithPrefix { + this := CreateNetworkIPv6WithPrefix{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateNetworkIPv6WithPrefix) GetGateway() (res CreateNetworkIPv6WithPrefixGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreateNetworkIPv6WithPrefix) GetGatewayOk() (ret CreateNetworkIPv6WithPrefixGetGatewayRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefix) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *CreateNetworkIPv6WithPrefix) SetGateway(v CreateNetworkIPv6WithPrefixGetGatewayRetType) { + setCreateNetworkIPv6WithPrefixGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *CreateNetworkIPv6WithPrefix) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *CreateNetworkIPv6WithPrefix) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv6WithPrefix) GetNameservers() (res CreateNetworkIPv6WithPrefixGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefix) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixGetNameserversRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefix) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv6WithPrefix) SetNameservers(v CreateNetworkIPv6WithPrefixGetNameserversRetType) { + setCreateNetworkIPv6WithPrefixGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefix returns the Prefix field value +func (o *CreateNetworkIPv6WithPrefix) GetPrefix() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefix) GetPrefixOk() (ret CreateNetworkIPv6WithPrefixGetPrefixRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *CreateNetworkIPv6WithPrefix) SetPrefix(v CreateNetworkIPv6WithPrefixGetPrefixRetType) { + setCreateNetworkIPv6WithPrefixGetPrefixAttributeType(&o.Prefix, v) +} + +func (o CreateNetworkIPv6WithPrefix) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv6WithPrefixGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv6WithPrefix struct { + value *CreateNetworkIPv6WithPrefix + isSet bool +} + +func (v NullableCreateNetworkIPv6WithPrefix) Get() *CreateNetworkIPv6WithPrefix { + return v.value +} + +func (v *NullableCreateNetworkIPv6WithPrefix) Set(val *CreateNetworkIPv6WithPrefix) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6WithPrefix) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6WithPrefix) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6WithPrefix(val *CreateNetworkIPv6WithPrefix) *NullableCreateNetworkIPv6WithPrefix { + return &NullableCreateNetworkIPv6WithPrefix{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6WithPrefix) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6WithPrefix) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_with_prefix_length.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_with_prefix_length.go new file mode 100644 index 00000000..8e6d5589 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_ipv6_with_prefix_length.go @@ -0,0 +1,173 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkIPv6WithPrefixLength type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkIPv6WithPrefixLength{} + +/* + types and functions for nameservers +*/ + +// isArray +type CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType = *[]string +type CreateNetworkIPv6WithPrefixLengthGetNameserversArgType = []string +type CreateNetworkIPv6WithPrefixLengthGetNameserversRetType = []string + +func getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType, val CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixLength +*/ + +// isLong +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType = *int64 +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType = int64 +type CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType = int64 + +func getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(arg CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType) (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(arg *CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType, val CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + *arg = &val +} + +// CreateNetworkIPv6WithPrefixLength The create request for an IPv6 network with a wanted prefix length. +type CreateNetworkIPv6WithPrefixLength struct { + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers CreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + PrefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType `json:"prefixLength" required:"true"` +} + +type _CreateNetworkIPv6WithPrefixLength CreateNetworkIPv6WithPrefixLength + +// NewCreateNetworkIPv6WithPrefixLength instantiates a new CreateNetworkIPv6WithPrefixLength object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkIPv6WithPrefixLength(prefixLength CreateNetworkIPv6WithPrefixLengthGetPrefixLengthArgType) *CreateNetworkIPv6WithPrefixLength { + this := CreateNetworkIPv6WithPrefixLength{} + setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&this.PrefixLength, prefixLength) + return &this +} + +// NewCreateNetworkIPv6WithPrefixLengthWithDefaults instantiates a new CreateNetworkIPv6WithPrefixLength object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkIPv6WithPrefixLengthWithDefaults() *CreateNetworkIPv6WithPrefixLength { + this := CreateNetworkIPv6WithPrefixLength{} + return &this +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *CreateNetworkIPv6WithPrefixLength) GetNameservers() (res CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefixLength) GetNameserversOk() (ret CreateNetworkIPv6WithPrefixLengthGetNameserversRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *CreateNetworkIPv6WithPrefixLength) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *CreateNetworkIPv6WithPrefixLength) SetNameservers(v CreateNetworkIPv6WithPrefixLengthGetNameserversRetType) { + setCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixLength returns the PrefixLength field value +func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLength() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + ret, _ = o.GetPrefixLengthOk() + return ret +} + +// GetPrefixLengthOk returns a tuple with the PrefixLength field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkIPv6WithPrefixLength) GetPrefixLengthOk() (ret CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType, ok bool) { + return getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength) +} + +// SetPrefixLength sets field value +func (o *CreateNetworkIPv6WithPrefixLength) SetPrefixLength(v CreateNetworkIPv6WithPrefixLengthGetPrefixLengthRetType) { + setCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeType(&o.PrefixLength, v) +} + +func (o CreateNetworkIPv6WithPrefixLength) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkIPv6WithPrefixLengthGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getCreateNetworkIPv6WithPrefixLengthGetPrefixLengthAttributeTypeOk(o.PrefixLength); ok { + toSerialize["PrefixLength"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkIPv6WithPrefixLength struct { + value *CreateNetworkIPv6WithPrefixLength + isSet bool +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) Get() *CreateNetworkIPv6WithPrefixLength { + return v.value +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) Set(val *CreateNetworkIPv6WithPrefixLength) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkIPv6WithPrefixLength(val *CreateNetworkIPv6WithPrefixLength) *NullableCreateNetworkIPv6WithPrefixLength { + return &NullableCreateNetworkIPv6WithPrefixLength{value: val, isSet: true} +} + +func (v NullableCreateNetworkIPv6WithPrefixLength) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkIPv6WithPrefixLength) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_payload.go new file mode 100644 index 00000000..1eb525e0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_network_payload.go @@ -0,0 +1,416 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNetworkPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNetworkPayload{} + +/* + types and functions for dhcp +*/ + +// isBoolean +type CreateNetworkPayloadgetDhcpAttributeType = *bool +type CreateNetworkPayloadgetDhcpArgType = bool +type CreateNetworkPayloadgetDhcpRetType = bool + +func getCreateNetworkPayloadgetDhcpAttributeTypeOk(arg CreateNetworkPayloadgetDhcpAttributeType) (ret CreateNetworkPayloadgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadgetDhcpAttributeType(arg *CreateNetworkPayloadgetDhcpAttributeType, val CreateNetworkPayloadgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isModel +type CreateNetworkPayloadGetIpv4AttributeType = *CreateNetworkIPv4 +type CreateNetworkPayloadGetIpv4ArgType = CreateNetworkIPv4 +type CreateNetworkPayloadGetIpv4RetType = CreateNetworkIPv4 + +func getCreateNetworkPayloadGetIpv4AttributeTypeOk(arg CreateNetworkPayloadGetIpv4AttributeType) (ret CreateNetworkPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetIpv4AttributeType(arg *CreateNetworkPayloadGetIpv4AttributeType, val CreateNetworkPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type CreateNetworkPayloadGetIpv6AttributeType = *CreateNetworkIPv6 +type CreateNetworkPayloadGetIpv6ArgType = CreateNetworkIPv6 +type CreateNetworkPayloadGetIpv6RetType = CreateNetworkIPv6 + +func getCreateNetworkPayloadGetIpv6AttributeTypeOk(arg CreateNetworkPayloadGetIpv6AttributeType) (ret CreateNetworkPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetIpv6AttributeType(arg *CreateNetworkPayloadGetIpv6AttributeType, val CreateNetworkPayloadGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateNetworkPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateNetworkPayloadGetLabelsArgType = map[string]interface{} +type CreateNetworkPayloadGetLabelsRetType = map[string]interface{} + +func getCreateNetworkPayloadGetLabelsAttributeTypeOk(arg CreateNetworkPayloadGetLabelsAttributeType) (ret CreateNetworkPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetLabelsAttributeType(arg *CreateNetworkPayloadGetLabelsAttributeType, val CreateNetworkPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateNetworkPayloadGetNameAttributeType = *string + +func getCreateNetworkPayloadGetNameAttributeTypeOk(arg CreateNetworkPayloadGetNameAttributeType) (ret CreateNetworkPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetNameAttributeType(arg *CreateNetworkPayloadGetNameAttributeType, val CreateNetworkPayloadGetNameRetType) { + *arg = &val +} + +type CreateNetworkPayloadGetNameArgType = string +type CreateNetworkPayloadGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type CreateNetworkPayloadgetRoutedAttributeType = *bool +type CreateNetworkPayloadgetRoutedArgType = bool +type CreateNetworkPayloadgetRoutedRetType = bool + +func getCreateNetworkPayloadgetRoutedAttributeTypeOk(arg CreateNetworkPayloadgetRoutedAttributeType) (ret CreateNetworkPayloadgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadgetRoutedAttributeType(arg *CreateNetworkPayloadgetRoutedAttributeType, val CreateNetworkPayloadgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type CreateNetworkPayloadGetRoutingTableIdAttributeType = *string + +func getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg CreateNetworkPayloadGetRoutingTableIdAttributeType) (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNetworkPayloadGetRoutingTableIdAttributeType(arg *CreateNetworkPayloadGetRoutingTableIdAttributeType, val CreateNetworkPayloadGetRoutingTableIdRetType) { + *arg = &val +} + +type CreateNetworkPayloadGetRoutingTableIdArgType = string +type CreateNetworkPayloadGetRoutingTableIdRetType = string + +// CreateNetworkPayload Object that represents the request body for a network create. +type CreateNetworkPayload struct { + // Enable or disable DHCP for a network. + Dhcp CreateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"` + Ipv4 CreateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 CreateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateNetworkPayloadGetNameAttributeType `json:"name" required:"true"` + // Shows if the network is routed and therefore accessible from other networks. + Routed CreateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId CreateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` +} + +type _CreateNetworkPayload CreateNetworkPayload + +// NewCreateNetworkPayload instantiates a new CreateNetworkPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNetworkPayload(name CreateNetworkPayloadGetNameArgType) *CreateNetworkPayload { + this := CreateNetworkPayload{} + setCreateNetworkPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateNetworkPayloadWithDefaults instantiates a new CreateNetworkPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNetworkPayloadWithDefaults() *CreateNetworkPayload { + this := CreateNetworkPayload{} + var dhcp bool = true + this.Dhcp = &dhcp + return &this +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetDhcp() (res CreateNetworkPayloadgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetDhcpOk() (ret CreateNetworkPayloadgetDhcpRetType, ok bool) { + return getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *CreateNetworkPayload) SetDhcp(v CreateNetworkPayloadgetDhcpRetType) { + setCreateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetIpv4() (res CreateNetworkPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetIpv4Ok() (ret CreateNetworkPayloadGetIpv4RetType, ok bool) { + return getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given CreateNetworkIPv4 and assigns it to the Ipv4 field. +func (o *CreateNetworkPayload) SetIpv4(v CreateNetworkPayloadGetIpv4RetType) { + setCreateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetIpv6() (res CreateNetworkPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetIpv6Ok() (ret CreateNetworkPayloadGetIpv6RetType, ok bool) { + return getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given CreateNetworkIPv6 and assigns it to the Ipv6 field. +func (o *CreateNetworkPayload) SetIpv6(v CreateNetworkPayloadGetIpv6RetType) { + setCreateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetLabels() (res CreateNetworkPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetLabelsOk() (ret CreateNetworkPayloadGetLabelsRetType, ok bool) { + return getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateNetworkPayload) SetLabels(v CreateNetworkPayloadGetLabelsRetType) { + setCreateNetworkPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateNetworkPayload) GetName() (ret CreateNetworkPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetNameOk() (ret CreateNetworkPayloadGetNameRetType, ok bool) { + return getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateNetworkPayload) SetName(v CreateNetworkPayloadGetNameRetType) { + setCreateNetworkPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetRouted() (res CreateNetworkPayloadgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetRoutedOk() (ret CreateNetworkPayloadgetRoutedRetType, ok bool) { + return getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *CreateNetworkPayload) SetRouted(v CreateNetworkPayloadgetRoutedRetType) { + setCreateNetworkPayloadgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *CreateNetworkPayload) GetRoutingTableId() (res CreateNetworkPayloadGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNetworkPayload) GetRoutingTableIdOk() (ret CreateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + return getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *CreateNetworkPayload) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *CreateNetworkPayload) SetRoutingTableId(v CreateNetworkPayloadGetRoutingTableIdRetType) { + setCreateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +func (o CreateNetworkPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getCreateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getCreateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getCreateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + return toSerialize, nil +} + +type NullableCreateNetworkPayload struct { + value *CreateNetworkPayload + isSet bool +} + +func (v NullableCreateNetworkPayload) Get() *CreateNetworkPayload { + return v.value +} + +func (v *NullableCreateNetworkPayload) Set(val *CreateNetworkPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNetworkPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNetworkPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNetworkPayload(val *CreateNetworkPayload) *NullableCreateNetworkPayload { + return &NullableCreateNetworkPayload{value: val, isSet: true} +} + +func (v NullableCreateNetworkPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNetworkPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_nic_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_nic_payload.go new file mode 100644 index 00000000..00f4cbd1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_nic_payload.go @@ -0,0 +1,764 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateNicPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateNicPayload{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type CreateNicPayloadGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type CreateNicPayloadGetAllowedAddressesArgType = []AllowedAddressesInner +type CreateNicPayloadGetAllowedAddressesRetType = []AllowedAddressesInner + +func getCreateNicPayloadGetAllowedAddressesAttributeTypeOk(arg CreateNicPayloadGetAllowedAddressesAttributeType) (ret CreateNicPayloadGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetAllowedAddressesAttributeType(arg *CreateNicPayloadGetAllowedAddressesAttributeType, val CreateNicPayloadGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateNicPayloadGetDescriptionAttributeType = *string + +func getCreateNicPayloadGetDescriptionAttributeTypeOk(arg CreateNicPayloadGetDescriptionAttributeType) (ret CreateNicPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetDescriptionAttributeType(arg *CreateNicPayloadGetDescriptionAttributeType, val CreateNicPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateNicPayloadGetDescriptionArgType = string +type CreateNicPayloadGetDescriptionRetType = string + +/* + types and functions for device +*/ + +// isNotNullableString +type CreateNicPayloadGetDeviceAttributeType = *string + +func getCreateNicPayloadGetDeviceAttributeTypeOk(arg CreateNicPayloadGetDeviceAttributeType) (ret CreateNicPayloadGetDeviceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetDeviceAttributeType(arg *CreateNicPayloadGetDeviceAttributeType, val CreateNicPayloadGetDeviceRetType) { + *arg = &val +} + +type CreateNicPayloadGetDeviceArgType = string +type CreateNicPayloadGetDeviceRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateNicPayloadGetIdAttributeType = *string + +func getCreateNicPayloadGetIdAttributeTypeOk(arg CreateNicPayloadGetIdAttributeType) (ret CreateNicPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetIdAttributeType(arg *CreateNicPayloadGetIdAttributeType, val CreateNicPayloadGetIdRetType) { + *arg = &val +} + +type CreateNicPayloadGetIdArgType = string +type CreateNicPayloadGetIdRetType = string + +/* + types and functions for ipv4 +*/ + +// isNotNullableString +type CreateNicPayloadGetIpv4AttributeType = *string + +func getCreateNicPayloadGetIpv4AttributeTypeOk(arg CreateNicPayloadGetIpv4AttributeType) (ret CreateNicPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetIpv4AttributeType(arg *CreateNicPayloadGetIpv4AttributeType, val CreateNicPayloadGetIpv4RetType) { + *arg = &val +} + +type CreateNicPayloadGetIpv4ArgType = string +type CreateNicPayloadGetIpv4RetType = string + +/* + types and functions for ipv6 +*/ + +// isNotNullableString +type CreateNicPayloadGetIpv6AttributeType = *string + +func getCreateNicPayloadGetIpv6AttributeTypeOk(arg CreateNicPayloadGetIpv6AttributeType) (ret CreateNicPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetIpv6AttributeType(arg *CreateNicPayloadGetIpv6AttributeType, val CreateNicPayloadGetIpv6RetType) { + *arg = &val +} + +type CreateNicPayloadGetIpv6ArgType = string +type CreateNicPayloadGetIpv6RetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateNicPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateNicPayloadGetLabelsArgType = map[string]interface{} +type CreateNicPayloadGetLabelsRetType = map[string]interface{} + +func getCreateNicPayloadGetLabelsAttributeTypeOk(arg CreateNicPayloadGetLabelsAttributeType) (ret CreateNicPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetLabelsAttributeType(arg *CreateNicPayloadGetLabelsAttributeType, val CreateNicPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mac +*/ + +// isNotNullableString +type CreateNicPayloadGetMacAttributeType = *string + +func getCreateNicPayloadGetMacAttributeTypeOk(arg CreateNicPayloadGetMacAttributeType) (ret CreateNicPayloadGetMacRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetMacAttributeType(arg *CreateNicPayloadGetMacAttributeType, val CreateNicPayloadGetMacRetType) { + *arg = &val +} + +type CreateNicPayloadGetMacArgType = string +type CreateNicPayloadGetMacRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateNicPayloadGetNameAttributeType = *string + +func getCreateNicPayloadGetNameAttributeTypeOk(arg CreateNicPayloadGetNameAttributeType) (ret CreateNicPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetNameAttributeType(arg *CreateNicPayloadGetNameAttributeType, val CreateNicPayloadGetNameRetType) { + *arg = &val +} + +type CreateNicPayloadGetNameArgType = string +type CreateNicPayloadGetNameRetType = string + +/* + types and functions for networkId +*/ + +// isNotNullableString +type CreateNicPayloadGetNetworkIdAttributeType = *string + +func getCreateNicPayloadGetNetworkIdAttributeTypeOk(arg CreateNicPayloadGetNetworkIdAttributeType) (ret CreateNicPayloadGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetNetworkIdAttributeType(arg *CreateNicPayloadGetNetworkIdAttributeType, val CreateNicPayloadGetNetworkIdRetType) { + *arg = &val +} + +type CreateNicPayloadGetNetworkIdArgType = string +type CreateNicPayloadGetNetworkIdRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type CreateNicPayloadgetNicSecurityAttributeType = *bool +type CreateNicPayloadgetNicSecurityArgType = bool +type CreateNicPayloadgetNicSecurityRetType = bool + +func getCreateNicPayloadgetNicSecurityAttributeTypeOk(arg CreateNicPayloadgetNicSecurityAttributeType) (ret CreateNicPayloadgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadgetNicSecurityAttributeType(arg *CreateNicPayloadgetNicSecurityAttributeType, val CreateNicPayloadgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isArray +type CreateNicPayloadGetSecurityGroupsAttributeType = *[]string +type CreateNicPayloadGetSecurityGroupsArgType = []string +type CreateNicPayloadGetSecurityGroupsRetType = []string + +func getCreateNicPayloadGetSecurityGroupsAttributeTypeOk(arg CreateNicPayloadGetSecurityGroupsAttributeType) (ret CreateNicPayloadGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetSecurityGroupsAttributeType(arg *CreateNicPayloadGetSecurityGroupsAttributeType, val CreateNicPayloadGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateNicPayloadGetStatusAttributeType = *string + +func getCreateNicPayloadGetStatusAttributeTypeOk(arg CreateNicPayloadGetStatusAttributeType) (ret CreateNicPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetStatusAttributeType(arg *CreateNicPayloadGetStatusAttributeType, val CreateNicPayloadGetStatusRetType) { + *arg = &val +} + +type CreateNicPayloadGetStatusArgType = string +type CreateNicPayloadGetStatusRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type CreateNicPayloadGetTypeAttributeType = *string + +func getCreateNicPayloadGetTypeAttributeTypeOk(arg CreateNicPayloadGetTypeAttributeType) (ret CreateNicPayloadGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateNicPayloadGetTypeAttributeType(arg *CreateNicPayloadGetTypeAttributeType, val CreateNicPayloadGetTypeRetType) { + *arg = &val +} + +type CreateNicPayloadGetTypeArgType = string +type CreateNicPayloadGetTypeRetType = string + +// CreateNicPayload Object that represents a network interface. +type CreateNicPayload struct { + // A list of IPs or CIDR notations. + AllowedAddresses CreateNicPayloadGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateNicPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Device CreateNicPayloadGetDeviceAttributeType `json:"device,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateNicPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents an IP address. + Ipv4 CreateNicPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + // String that represents an IPv6 address. + Ipv6 CreateNicPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateNicPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Object that represents an MAC address. + Mac CreateNicPayloadGetMacAttributeType `json:"mac,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name CreateNicPayloadGetNameAttributeType `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + NetworkId CreateNicPayloadGetNetworkIdAttributeType `json:"networkId,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity CreateNicPayloadgetNicSecurityAttributeType `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups CreateNicPayloadGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // Possible values: `ACTIVE`, `DOWN`. + Status CreateNicPayloadGetStatusAttributeType `json:"status,omitempty"` + // Possible values: `server`, `metadata`, `gateway`, `none`. + Type CreateNicPayloadGetTypeAttributeType `json:"type,omitempty"` +} + +// NewCreateNicPayload instantiates a new CreateNicPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateNicPayload() *CreateNicPayload { + this := CreateNicPayload{} + return &this +} + +// NewCreateNicPayloadWithDefaults instantiates a new CreateNicPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateNicPayloadWithDefaults() *CreateNicPayload { + this := CreateNicPayload{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *CreateNicPayload) GetAllowedAddresses() (res CreateNicPayloadGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetAllowedAddressesOk() (ret CreateNicPayloadGetAllowedAddressesRetType, ok bool) { + return getCreateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *CreateNicPayload) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *CreateNicPayload) SetAllowedAddresses(v CreateNicPayloadGetAllowedAddressesRetType) { + setCreateNicPayloadGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateNicPayload) GetDescription() (res CreateNicPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetDescriptionOk() (ret CreateNicPayloadGetDescriptionRetType, ok bool) { + return getCreateNicPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateNicPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateNicPayload) SetDescription(v CreateNicPayloadGetDescriptionRetType) { + setCreateNicPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *CreateNicPayload) GetDevice() (res CreateNicPayloadGetDeviceRetType) { + res, _ = o.GetDeviceOk() + return +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetDeviceOk() (ret CreateNicPayloadGetDeviceRetType, ok bool) { + return getCreateNicPayloadGetDeviceAttributeTypeOk(o.Device) +} + +// HasDevice returns a boolean if a field has been set. +func (o *CreateNicPayload) HasDevice() bool { + _, ok := o.GetDeviceOk() + return ok +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +func (o *CreateNicPayload) SetDevice(v CreateNicPayloadGetDeviceRetType) { + setCreateNicPayloadGetDeviceAttributeType(&o.Device, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateNicPayload) GetId() (res CreateNicPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetIdOk() (ret CreateNicPayloadGetIdRetType, ok bool) { + return getCreateNicPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateNicPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateNicPayload) SetId(v CreateNicPayloadGetIdRetType) { + setCreateNicPayloadGetIdAttributeType(&o.Id, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *CreateNicPayload) GetIpv4() (res CreateNicPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetIpv4Ok() (ret CreateNicPayloadGetIpv4RetType, ok bool) { + return getCreateNicPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *CreateNicPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *CreateNicPayload) SetIpv4(v CreateNicPayloadGetIpv4RetType) { + setCreateNicPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *CreateNicPayload) GetIpv6() (res CreateNicPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetIpv6Ok() (ret CreateNicPayloadGetIpv6RetType, ok bool) { + return getCreateNicPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *CreateNicPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *CreateNicPayload) SetIpv6(v CreateNicPayloadGetIpv6RetType) { + setCreateNicPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateNicPayload) GetLabels() (res CreateNicPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetLabelsOk() (ret CreateNicPayloadGetLabelsRetType, ok bool) { + return getCreateNicPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateNicPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateNicPayload) SetLabels(v CreateNicPayloadGetLabelsRetType) { + setCreateNicPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *CreateNicPayload) GetMac() (res CreateNicPayloadGetMacRetType) { + res, _ = o.GetMacOk() + return +} + +// GetMacOk returns a tuple with the Mac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetMacOk() (ret CreateNicPayloadGetMacRetType, ok bool) { + return getCreateNicPayloadGetMacAttributeTypeOk(o.Mac) +} + +// HasMac returns a boolean if a field has been set. +func (o *CreateNicPayload) HasMac() bool { + _, ok := o.GetMacOk() + return ok +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *CreateNicPayload) SetMac(v CreateNicPayloadGetMacRetType) { + setCreateNicPayloadGetMacAttributeType(&o.Mac, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateNicPayload) GetName() (res CreateNicPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetNameOk() (ret CreateNicPayloadGetNameRetType, ok bool) { + return getCreateNicPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateNicPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateNicPayload) SetName(v CreateNicPayloadGetNameRetType) { + setCreateNicPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *CreateNicPayload) GetNetworkId() (res CreateNicPayloadGetNetworkIdRetType) { + res, _ = o.GetNetworkIdOk() + return +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetNetworkIdOk() (ret CreateNicPayloadGetNetworkIdRetType, ok bool) { + return getCreateNicPayloadGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *CreateNicPayload) HasNetworkId() bool { + _, ok := o.GetNetworkIdOk() + return ok +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *CreateNicPayload) SetNetworkId(v CreateNicPayloadGetNetworkIdRetType) { + setCreateNicPayloadGetNetworkIdAttributeType(&o.NetworkId, v) +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *CreateNicPayload) GetNicSecurity() (res CreateNicPayloadgetNicSecurityRetType) { + res, _ = o.GetNicSecurityOk() + return +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetNicSecurityOk() (ret CreateNicPayloadgetNicSecurityRetType, ok bool) { + return getCreateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *CreateNicPayload) HasNicSecurity() bool { + _, ok := o.GetNicSecurityOk() + return ok +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +func (o *CreateNicPayload) SetNicSecurity(v CreateNicPayloadgetNicSecurityRetType) { + setCreateNicPayloadgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *CreateNicPayload) GetSecurityGroups() (res CreateNicPayloadGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetSecurityGroupsOk() (ret CreateNicPayloadGetSecurityGroupsRetType, ok bool) { + return getCreateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *CreateNicPayload) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *CreateNicPayload) SetSecurityGroups(v CreateNicPayloadGetSecurityGroupsRetType) { + setCreateNicPayloadGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateNicPayload) GetStatus() (res CreateNicPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetStatusOk() (ret CreateNicPayloadGetStatusRetType, ok bool) { + return getCreateNicPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateNicPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateNicPayload) SetStatus(v CreateNicPayloadGetStatusRetType) { + setCreateNicPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *CreateNicPayload) GetType() (res CreateNicPayloadGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateNicPayload) GetTypeOk() (ret CreateNicPayloadGetTypeRetType, ok bool) { + return getCreateNicPayloadGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *CreateNicPayload) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *CreateNicPayload) SetType(v CreateNicPayloadGetTypeRetType) { + setCreateNicPayloadGetTypeAttributeType(&o.Type, v) +} + +func (o CreateNicPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getCreateNicPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateNicPayloadGetDeviceAttributeTypeOk(o.Device); ok { + toSerialize["Device"] = val + } + if val, ok := getCreateNicPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateNicPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getCreateNicPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getCreateNicPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateNicPayloadGetMacAttributeTypeOk(o.Mac); ok { + toSerialize["Mac"] = val + } + if val, ok := getCreateNicPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateNicPayloadGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + if val, ok := getCreateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getCreateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getCreateNicPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateNicPayloadGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableCreateNicPayload struct { + value *CreateNicPayload + isSet bool +} + +func (v NullableCreateNicPayload) Get() *CreateNicPayload { + return v.value +} + +func (v *NullableCreateNicPayload) Set(val *CreateNicPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateNicPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateNicPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateNicPayload(val *CreateNicPayload) *NullableCreateNicPayload { + return &NullableCreateNicPayload{value: val, isSet: true} +} + +func (v NullableCreateNicPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateNicPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_protocol.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_protocol.go new file mode 100644 index 00000000..e5d06c3a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_protocol.go @@ -0,0 +1,144 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// CreateProtocol - The schema for a protocol when creating a security group rule. +type CreateProtocol struct { + Int64 *int64 + String *string +} + +// int64AsCreateProtocol is a convenience function that returns int64 wrapped in CreateProtocol +func Int64AsCreateProtocol(v *int64) CreateProtocol { + return CreateProtocol{ + Int64: v, + } +} + +// stringAsCreateProtocol is a convenience function that returns string wrapped in CreateProtocol +func StringAsCreateProtocol(v *string) CreateProtocol { + return CreateProtocol{ + String: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateProtocol) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into Int64 + dstCreateProtocol1 := &CreateProtocol{} + err = json.Unmarshal(data, &dstCreateProtocol1.Int64) + if err == nil { + jsonint64, _ := json.Marshal(&dstCreateProtocol1.Int64) + if string(jsonint64) != "{}" { // empty struct + dst.Int64 = dstCreateProtocol1.Int64 + match++ + } + } + + // try to unmarshal data into String + dstCreateProtocol2 := &CreateProtocol{} + err = json.Unmarshal(data, &dstCreateProtocol2.String) + if err == nil { + jsonstring, _ := json.Marshal(&dstCreateProtocol2.String) + if string(jsonstring) != "{}" { // empty struct + dst.String = dstCreateProtocol2.String + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.Int64 = nil + dst.String = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateProtocol)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateProtocol)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateProtocol) MarshalJSON() ([]byte, error) { + if src.Int64 != nil { + return json.Marshal(&src.Int64) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateProtocol) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.Int64 != nil { + return obj.Int64 + } + + if obj.String != nil { + return obj.String + } + + // all schemas are nil + return nil +} + +type NullableCreateProtocol struct { + value *CreateProtocol + isSet bool +} + +func (v NullableCreateProtocol) Get() *CreateProtocol { + return v.value +} + +func (v *NullableCreateProtocol) Set(val *CreateProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableCreateProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateProtocol(val *CreateProtocol) *NullableCreateProtocol { + return &NullableCreateProtocol{value: val, isSet: true} +} + +func (v NullableCreateProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_public_ip_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_public_ip_payload.go new file mode 100644 index 00000000..d5774528 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_public_ip_payload.go @@ -0,0 +1,290 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreatePublicIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreatePublicIPPayload{} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreatePublicIPPayloadGetIdAttributeType = *string + +func getCreatePublicIPPayloadGetIdAttributeTypeOk(arg CreatePublicIPPayloadGetIdAttributeType) (ret CreatePublicIPPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreatePublicIPPayloadGetIdAttributeType(arg *CreatePublicIPPayloadGetIdAttributeType, val CreatePublicIPPayloadGetIdRetType) { + *arg = &val +} + +type CreatePublicIPPayloadGetIdArgType = string +type CreatePublicIPPayloadGetIdRetType = string + +/* + types and functions for ip +*/ + +// isNotNullableString +type CreatePublicIPPayloadGetIpAttributeType = *string + +func getCreatePublicIPPayloadGetIpAttributeTypeOk(arg CreatePublicIPPayloadGetIpAttributeType) (ret CreatePublicIPPayloadGetIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreatePublicIPPayloadGetIpAttributeType(arg *CreatePublicIPPayloadGetIpAttributeType, val CreatePublicIPPayloadGetIpRetType) { + *arg = &val +} + +type CreatePublicIPPayloadGetIpArgType = string +type CreatePublicIPPayloadGetIpRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreatePublicIPPayloadGetLabelsAttributeType = *map[string]interface{} +type CreatePublicIPPayloadGetLabelsArgType = map[string]interface{} +type CreatePublicIPPayloadGetLabelsRetType = map[string]interface{} + +func getCreatePublicIPPayloadGetLabelsAttributeTypeOk(arg CreatePublicIPPayloadGetLabelsAttributeType) (ret CreatePublicIPPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreatePublicIPPayloadGetLabelsAttributeType(arg *CreatePublicIPPayloadGetLabelsAttributeType, val CreatePublicIPPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for networkInterface +*/ + +// isNullableString +type CreatePublicIPPayloadGetNetworkInterfaceAttributeType = *NullableString + +func getCreatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(arg CreatePublicIPPayloadGetNetworkInterfaceAttributeType) (ret CreatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setCreatePublicIPPayloadGetNetworkInterfaceAttributeType(arg *CreatePublicIPPayloadGetNetworkInterfaceAttributeType, val CreatePublicIPPayloadGetNetworkInterfaceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type CreatePublicIPPayloadGetNetworkInterfaceArgType = *string +type CreatePublicIPPayloadGetNetworkInterfaceRetType = *string + +// CreatePublicIPPayload Object that represents a public IP. +type CreatePublicIPPayload struct { + // Universally Unique Identifier (UUID). + Id CreatePublicIPPayloadGetIdAttributeType `json:"id,omitempty"` + // String that represents an IPv4 address. + Ip CreatePublicIPPayloadGetIpAttributeType `json:"ip,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreatePublicIPPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Universally Unique Identifier (UUID). + NetworkInterface CreatePublicIPPayloadGetNetworkInterfaceAttributeType `json:"networkInterface,omitempty"` +} + +// NewCreatePublicIPPayload instantiates a new CreatePublicIPPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreatePublicIPPayload() *CreatePublicIPPayload { + this := CreatePublicIPPayload{} + return &this +} + +// NewCreatePublicIPPayloadWithDefaults instantiates a new CreatePublicIPPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreatePublicIPPayloadWithDefaults() *CreatePublicIPPayload { + this := CreatePublicIPPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) GetId() (res CreatePublicIPPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePublicIPPayload) GetIdOk() (ret CreatePublicIPPayloadGetIdRetType, ok bool) { + return getCreatePublicIPPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreatePublicIPPayload) SetId(v CreatePublicIPPayloadGetIdRetType) { + setCreatePublicIPPayloadGetIdAttributeType(&o.Id, v) +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) GetIp() (res CreatePublicIPPayloadGetIpRetType) { + res, _ = o.GetIpOk() + return +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePublicIPPayload) GetIpOk() (ret CreatePublicIPPayloadGetIpRetType, ok bool) { + return getCreatePublicIPPayloadGetIpAttributeTypeOk(o.Ip) +} + +// HasIp returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasIp() bool { + _, ok := o.GetIpOk() + return ok +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *CreatePublicIPPayload) SetIp(v CreatePublicIPPayloadGetIpRetType) { + setCreatePublicIPPayloadGetIpAttributeType(&o.Ip, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreatePublicIPPayload) GetLabels() (res CreatePublicIPPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreatePublicIPPayload) GetLabelsOk() (ret CreatePublicIPPayloadGetLabelsRetType, ok bool) { + return getCreatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreatePublicIPPayload) SetLabels(v CreatePublicIPPayloadGetLabelsRetType) { + setCreatePublicIPPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreatePublicIPPayload) GetNetworkInterface() (res CreatePublicIPPayloadGetNetworkInterfaceRetType) { + res, _ = o.GetNetworkInterfaceOk() + return +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CreatePublicIPPayload) GetNetworkInterfaceOk() (ret CreatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + return getCreatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface) +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *CreatePublicIPPayload) HasNetworkInterface() bool { + _, ok := o.GetNetworkInterfaceOk() + return ok +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *CreatePublicIPPayload) SetNetworkInterface(v CreatePublicIPPayloadGetNetworkInterfaceRetType) { + setCreatePublicIPPayloadGetNetworkInterfaceAttributeType(&o.NetworkInterface, v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *CreatePublicIPPayload) SetNetworkInterfaceNil() { + o.NetworkInterface = nil +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *CreatePublicIPPayload) UnsetNetworkInterface() { + o.NetworkInterface = nil +} + +func (o CreatePublicIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreatePublicIPPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreatePublicIPPayloadGetIpAttributeTypeOk(o.Ip); ok { + toSerialize["Ip"] = val + } + if val, ok := getCreatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface); ok { + toSerialize["NetworkInterface"] = val + } + return toSerialize, nil +} + +type NullableCreatePublicIPPayload struct { + value *CreatePublicIPPayload + isSet bool +} + +func (v NullableCreatePublicIPPayload) Get() *CreatePublicIPPayload { + return v.value +} + +func (v *NullableCreatePublicIPPayload) Set(val *CreatePublicIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreatePublicIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreatePublicIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreatePublicIPPayload(val *CreatePublicIPPayload) *NullableCreatePublicIPPayload { + return &NullableCreatePublicIPPayload{value: val, isSet: true} +} + +func (v NullableCreatePublicIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreatePublicIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_payload.go new file mode 100644 index 00000000..9016a7ad --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_payload.go @@ -0,0 +1,468 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSecurityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateSecurityGroupPayloadGetCreatedAtAttributeType = *time.Time +type CreateSecurityGroupPayloadGetCreatedAtArgType = time.Time +type CreateSecurityGroupPayloadGetCreatedAtRetType = time.Time + +func getCreateSecurityGroupPayloadGetCreatedAtAttributeTypeOk(arg CreateSecurityGroupPayloadGetCreatedAtAttributeType) (ret CreateSecurityGroupPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetCreatedAtAttributeType(arg *CreateSecurityGroupPayloadGetCreatedAtAttributeType, val CreateSecurityGroupPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateSecurityGroupPayloadGetDescriptionAttributeType = *string + +func getCreateSecurityGroupPayloadGetDescriptionAttributeTypeOk(arg CreateSecurityGroupPayloadGetDescriptionAttributeType) (ret CreateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetDescriptionAttributeType(arg *CreateSecurityGroupPayloadGetDescriptionAttributeType, val CreateSecurityGroupPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateSecurityGroupPayloadGetDescriptionArgType = string +type CreateSecurityGroupPayloadGetDescriptionRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateSecurityGroupPayloadGetIdAttributeType = *string + +func getCreateSecurityGroupPayloadGetIdAttributeTypeOk(arg CreateSecurityGroupPayloadGetIdAttributeType) (ret CreateSecurityGroupPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetIdAttributeType(arg *CreateSecurityGroupPayloadGetIdAttributeType, val CreateSecurityGroupPayloadGetIdRetType) { + *arg = &val +} + +type CreateSecurityGroupPayloadGetIdArgType = string +type CreateSecurityGroupPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateSecurityGroupPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateSecurityGroupPayloadGetLabelsArgType = map[string]interface{} +type CreateSecurityGroupPayloadGetLabelsRetType = map[string]interface{} + +func getCreateSecurityGroupPayloadGetLabelsAttributeTypeOk(arg CreateSecurityGroupPayloadGetLabelsAttributeType) (ret CreateSecurityGroupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetLabelsAttributeType(arg *CreateSecurityGroupPayloadGetLabelsAttributeType, val CreateSecurityGroupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateSecurityGroupPayloadGetNameAttributeType = *string + +func getCreateSecurityGroupPayloadGetNameAttributeTypeOk(arg CreateSecurityGroupPayloadGetNameAttributeType) (ret CreateSecurityGroupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetNameAttributeType(arg *CreateSecurityGroupPayloadGetNameAttributeType, val CreateSecurityGroupPayloadGetNameRetType) { + *arg = &val +} + +type CreateSecurityGroupPayloadGetNameArgType = string +type CreateSecurityGroupPayloadGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type CreateSecurityGroupPayloadGetRulesAttributeType = *[]SecurityGroupRule +type CreateSecurityGroupPayloadGetRulesArgType = []SecurityGroupRule +type CreateSecurityGroupPayloadGetRulesRetType = []SecurityGroupRule + +func getCreateSecurityGroupPayloadGetRulesAttributeTypeOk(arg CreateSecurityGroupPayloadGetRulesAttributeType) (ret CreateSecurityGroupPayloadGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetRulesAttributeType(arg *CreateSecurityGroupPayloadGetRulesAttributeType, val CreateSecurityGroupPayloadGetRulesRetType) { + *arg = &val +} + +/* + types and functions for stateful +*/ + +// isBoolean +type CreateSecurityGroupPayloadgetStatefulAttributeType = *bool +type CreateSecurityGroupPayloadgetStatefulArgType = bool +type CreateSecurityGroupPayloadgetStatefulRetType = bool + +func getCreateSecurityGroupPayloadgetStatefulAttributeTypeOk(arg CreateSecurityGroupPayloadgetStatefulAttributeType) (ret CreateSecurityGroupPayloadgetStatefulRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadgetStatefulAttributeType(arg *CreateSecurityGroupPayloadgetStatefulAttributeType, val CreateSecurityGroupPayloadgetStatefulRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateSecurityGroupPayloadGetUpdatedAtAttributeType = *time.Time +type CreateSecurityGroupPayloadGetUpdatedAtArgType = time.Time +type CreateSecurityGroupPayloadGetUpdatedAtRetType = time.Time + +func getCreateSecurityGroupPayloadGetUpdatedAtAttributeTypeOk(arg CreateSecurityGroupPayloadGetUpdatedAtAttributeType) (ret CreateSecurityGroupPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupPayloadGetUpdatedAtAttributeType(arg *CreateSecurityGroupPayloadGetUpdatedAtAttributeType, val CreateSecurityGroupPayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateSecurityGroupPayload Object that represents a security group. +type CreateSecurityGroupPayload struct { + // Date-time when resource was created. + CreatedAt CreateSecurityGroupPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateSecurityGroupPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateSecurityGroupPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateSecurityGroupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name CreateSecurityGroupPayloadGetNameAttributeType `json:"name" required:"true"` + // A list containing security group rule objects. + Rules CreateSecurityGroupPayloadGetRulesAttributeType `json:"rules,omitempty"` + // Shows if a security group is stateful or stateless. You can only have one type of security groups per network interface/server. + Stateful CreateSecurityGroupPayloadgetStatefulAttributeType `json:"stateful,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateSecurityGroupPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateSecurityGroupPayload CreateSecurityGroupPayload + +// NewCreateSecurityGroupPayload instantiates a new CreateSecurityGroupPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSecurityGroupPayload(name CreateSecurityGroupPayloadGetNameArgType) *CreateSecurityGroupPayload { + this := CreateSecurityGroupPayload{} + setCreateSecurityGroupPayloadGetNameAttributeType(&this.Name, name) + return &this +} + +// NewCreateSecurityGroupPayloadWithDefaults instantiates a new CreateSecurityGroupPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSecurityGroupPayloadWithDefaults() *CreateSecurityGroupPayload { + this := CreateSecurityGroupPayload{} + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetCreatedAt() (res CreateSecurityGroupPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetCreatedAtOk() (ret CreateSecurityGroupPayloadGetCreatedAtRetType, ok bool) { + return getCreateSecurityGroupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateSecurityGroupPayload) SetCreatedAt(v CreateSecurityGroupPayloadGetCreatedAtRetType) { + setCreateSecurityGroupPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetDescription() (res CreateSecurityGroupPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetDescriptionOk() (ret CreateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + return getCreateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateSecurityGroupPayload) SetDescription(v CreateSecurityGroupPayloadGetDescriptionRetType) { + setCreateSecurityGroupPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetId() (res CreateSecurityGroupPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetIdOk() (ret CreateSecurityGroupPayloadGetIdRetType, ok bool) { + return getCreateSecurityGroupPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateSecurityGroupPayload) SetId(v CreateSecurityGroupPayloadGetIdRetType) { + setCreateSecurityGroupPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetLabels() (res CreateSecurityGroupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetLabelsOk() (ret CreateSecurityGroupPayloadGetLabelsRetType, ok bool) { + return getCreateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateSecurityGroupPayload) SetLabels(v CreateSecurityGroupPayloadGetLabelsRetType) { + setCreateSecurityGroupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *CreateSecurityGroupPayload) GetName() (ret CreateSecurityGroupPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetNameOk() (ret CreateSecurityGroupPayloadGetNameRetType, ok bool) { + return getCreateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateSecurityGroupPayload) SetName(v CreateSecurityGroupPayloadGetNameRetType) { + setCreateSecurityGroupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetRules() (res CreateSecurityGroupPayloadGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetRulesOk() (ret CreateSecurityGroupPayloadGetRulesRetType, ok bool) { + return getCreateSecurityGroupPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []SecurityGroupRule and assigns it to the Rules field. +func (o *CreateSecurityGroupPayload) SetRules(v CreateSecurityGroupPayloadGetRulesRetType) { + setCreateSecurityGroupPayloadGetRulesAttributeType(&o.Rules, v) +} + +// GetStateful returns the Stateful field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetStateful() (res CreateSecurityGroupPayloadgetStatefulRetType) { + res, _ = o.GetStatefulOk() + return +} + +// GetStatefulOk returns a tuple with the Stateful field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetStatefulOk() (ret CreateSecurityGroupPayloadgetStatefulRetType, ok bool) { + return getCreateSecurityGroupPayloadgetStatefulAttributeTypeOk(o.Stateful) +} + +// HasStateful returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasStateful() bool { + _, ok := o.GetStatefulOk() + return ok +} + +// SetStateful gets a reference to the given bool and assigns it to the Stateful field. +func (o *CreateSecurityGroupPayload) SetStateful(v CreateSecurityGroupPayloadgetStatefulRetType) { + setCreateSecurityGroupPayloadgetStatefulAttributeType(&o.Stateful, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupPayload) GetUpdatedAt() (res CreateSecurityGroupPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupPayload) GetUpdatedAtOk() (ret CreateSecurityGroupPayloadGetUpdatedAtRetType, ok bool) { + return getCreateSecurityGroupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateSecurityGroupPayload) SetUpdatedAt(v CreateSecurityGroupPayloadGetUpdatedAtRetType) { + setCreateSecurityGroupPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateSecurityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSecurityGroupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + if val, ok := getCreateSecurityGroupPayloadgetStatefulAttributeTypeOk(o.Stateful); ok { + toSerialize["Stateful"] = val + } + if val, ok := getCreateSecurityGroupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupPayload struct { + value *CreateSecurityGroupPayload + isSet bool +} + +func (v NullableCreateSecurityGroupPayload) Get() *CreateSecurityGroupPayload { + return v.value +} + +func (v *NullableCreateSecurityGroupPayload) Set(val *CreateSecurityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupPayload(val *CreateSecurityGroupPayload) *NullableCreateSecurityGroupPayload { + return &NullableCreateSecurityGroupPayload{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_rule_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_rule_payload.go new file mode 100644 index 00000000..32175cb0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_rule_payload.go @@ -0,0 +1,661 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSecurityGroupRulePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupRulePayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateSecurityGroupRulePayloadGetCreatedAtAttributeType = *time.Time +type CreateSecurityGroupRulePayloadGetCreatedAtArgType = time.Time +type CreateSecurityGroupRulePayloadGetCreatedAtRetType = time.Time + +func getCreateSecurityGroupRulePayloadGetCreatedAtAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetCreatedAtAttributeType) (ret CreateSecurityGroupRulePayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetCreatedAtAttributeType(arg *CreateSecurityGroupRulePayloadGetCreatedAtAttributeType, val CreateSecurityGroupRulePayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetDescriptionAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetDescriptionAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetDescriptionAttributeType) (ret CreateSecurityGroupRulePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetDescriptionAttributeType(arg *CreateSecurityGroupRulePayloadGetDescriptionAttributeType, val CreateSecurityGroupRulePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetDescriptionArgType = string +type CreateSecurityGroupRulePayloadGetDescriptionRetType = string + +/* + types and functions for direction +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetDirectionAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetDirectionAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetDirectionAttributeType) (ret CreateSecurityGroupRulePayloadGetDirectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetDirectionAttributeType(arg *CreateSecurityGroupRulePayloadGetDirectionAttributeType, val CreateSecurityGroupRulePayloadGetDirectionRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetDirectionArgType = string +type CreateSecurityGroupRulePayloadGetDirectionRetType = string + +/* + types and functions for ethertype +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetEthertypeAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetEthertypeAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetEthertypeAttributeType) (ret CreateSecurityGroupRulePayloadGetEthertypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetEthertypeAttributeType(arg *CreateSecurityGroupRulePayloadGetEthertypeAttributeType, val CreateSecurityGroupRulePayloadGetEthertypeRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetEthertypeArgType = string +type CreateSecurityGroupRulePayloadGetEthertypeRetType = string + +/* + types and functions for icmpParameters +*/ + +// isModel +type CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType = *ICMPParameters +type CreateSecurityGroupRulePayloadGetIcmpParametersArgType = ICMPParameters +type CreateSecurityGroupRulePayloadGetIcmpParametersRetType = ICMPParameters + +func getCreateSecurityGroupRulePayloadGetIcmpParametersAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType) (ret CreateSecurityGroupRulePayloadGetIcmpParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetIcmpParametersAttributeType(arg *CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType, val CreateSecurityGroupRulePayloadGetIcmpParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetIdAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetIdAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetIdAttributeType) (ret CreateSecurityGroupRulePayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetIdAttributeType(arg *CreateSecurityGroupRulePayloadGetIdAttributeType, val CreateSecurityGroupRulePayloadGetIdRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetIdArgType = string +type CreateSecurityGroupRulePayloadGetIdRetType = string + +/* + types and functions for ipRange +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetIpRangeAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetIpRangeAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetIpRangeAttributeType) (ret CreateSecurityGroupRulePayloadGetIpRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetIpRangeAttributeType(arg *CreateSecurityGroupRulePayloadGetIpRangeAttributeType, val CreateSecurityGroupRulePayloadGetIpRangeRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetIpRangeArgType = string +type CreateSecurityGroupRulePayloadGetIpRangeRetType = string + +/* + types and functions for portRange +*/ + +// isModel +type CreateSecurityGroupRulePayloadGetPortRangeAttributeType = *PortRange +type CreateSecurityGroupRulePayloadGetPortRangeArgType = PortRange +type CreateSecurityGroupRulePayloadGetPortRangeRetType = PortRange + +func getCreateSecurityGroupRulePayloadGetPortRangeAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetPortRangeAttributeType) (ret CreateSecurityGroupRulePayloadGetPortRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetPortRangeAttributeType(arg *CreateSecurityGroupRulePayloadGetPortRangeAttributeType, val CreateSecurityGroupRulePayloadGetPortRangeRetType) { + *arg = &val +} + +/* + types and functions for remoteSecurityGroupId +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType) (ret CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType(arg *CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType, val CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdArgType = string +type CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType = string + +/* + types and functions for securityGroupId +*/ + +// isNotNullableString +type CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType = *string + +func getCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType) (ret CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType(arg *CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType, val CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType) { + *arg = &val +} + +type CreateSecurityGroupRulePayloadGetSecurityGroupIdArgType = string +type CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType = *time.Time +type CreateSecurityGroupRulePayloadGetUpdatedAtArgType = time.Time +type CreateSecurityGroupRulePayloadGetUpdatedAtRetType = time.Time + +func getCreateSecurityGroupRulePayloadGetUpdatedAtAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType) (ret CreateSecurityGroupRulePayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetUpdatedAtAttributeType(arg *CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType, val CreateSecurityGroupRulePayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for protocol +*/ + +// isModel +type CreateSecurityGroupRulePayloadGetProtocolAttributeType = *CreateProtocol +type CreateSecurityGroupRulePayloadGetProtocolArgType = CreateProtocol +type CreateSecurityGroupRulePayloadGetProtocolRetType = CreateProtocol + +func getCreateSecurityGroupRulePayloadGetProtocolAttributeTypeOk(arg CreateSecurityGroupRulePayloadGetProtocolAttributeType) (ret CreateSecurityGroupRulePayloadGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRulePayloadGetProtocolAttributeType(arg *CreateSecurityGroupRulePayloadGetProtocolAttributeType, val CreateSecurityGroupRulePayloadGetProtocolRetType) { + *arg = &val +} + +// CreateSecurityGroupRulePayload Object that represents a request body for security group rule creation. +type CreateSecurityGroupRulePayload struct { + // Date-time when resource was created. + CreatedAt CreateSecurityGroupRulePayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateSecurityGroupRulePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // The direction of the traffic which the rule should match. Possible values: `ingress`, `egress`. + // REQUIRED + Direction CreateSecurityGroupRulePayloadGetDirectionAttributeType `json:"direction" required:"true"` + // The ethertype which the rule should match. Possible values: `IPv4`, `IPv6`. + Ethertype CreateSecurityGroupRulePayloadGetEthertypeAttributeType `json:"ethertype,omitempty"` + IcmpParameters CreateSecurityGroupRulePayloadGetIcmpParametersAttributeType `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateSecurityGroupRulePayloadGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange CreateSecurityGroupRulePayloadGetIpRangeAttributeType `json:"ipRange,omitempty"` + PortRange CreateSecurityGroupRulePayloadGetPortRangeAttributeType `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId CreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType `json:"securityGroupId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateSecurityGroupRulePayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + Protocol CreateSecurityGroupRulePayloadGetProtocolAttributeType `json:"protocol,omitempty"` +} + +type _CreateSecurityGroupRulePayload CreateSecurityGroupRulePayload + +// NewCreateSecurityGroupRulePayload instantiates a new CreateSecurityGroupRulePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSecurityGroupRulePayload(direction CreateSecurityGroupRulePayloadGetDirectionArgType) *CreateSecurityGroupRulePayload { + this := CreateSecurityGroupRulePayload{} + setCreateSecurityGroupRulePayloadGetDirectionAttributeType(&this.Direction, direction) + return &this +} + +// NewCreateSecurityGroupRulePayloadWithDefaults instantiates a new CreateSecurityGroupRulePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSecurityGroupRulePayloadWithDefaults() *CreateSecurityGroupRulePayload { + this := CreateSecurityGroupRulePayload{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetCreatedAt() (res CreateSecurityGroupRulePayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetCreatedAtOk() (ret CreateSecurityGroupRulePayloadGetCreatedAtRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateSecurityGroupRulePayload) SetCreatedAt(v CreateSecurityGroupRulePayloadGetCreatedAtRetType) { + setCreateSecurityGroupRulePayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetDescription() (res CreateSecurityGroupRulePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetDescriptionOk() (ret CreateSecurityGroupRulePayloadGetDescriptionRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateSecurityGroupRulePayload) SetDescription(v CreateSecurityGroupRulePayloadGetDescriptionRetType) { + setCreateSecurityGroupRulePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDirection returns the Direction field value +func (o *CreateSecurityGroupRulePayload) GetDirection() (ret CreateSecurityGroupRulePayloadGetDirectionRetType) { + ret, _ = o.GetDirectionOk() + return ret +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetDirectionOk() (ret CreateSecurityGroupRulePayloadGetDirectionRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetDirectionAttributeTypeOk(o.Direction) +} + +// SetDirection sets field value +func (o *CreateSecurityGroupRulePayload) SetDirection(v CreateSecurityGroupRulePayloadGetDirectionRetType) { + setCreateSecurityGroupRulePayloadGetDirectionAttributeType(&o.Direction, v) +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetEthertype() (res CreateSecurityGroupRulePayloadGetEthertypeRetType) { + res, _ = o.GetEthertypeOk() + return +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetEthertypeOk() (ret CreateSecurityGroupRulePayloadGetEthertypeRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetEthertypeAttributeTypeOk(o.Ethertype) +} + +// HasEthertype returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasEthertype() bool { + _, ok := o.GetEthertypeOk() + return ok +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *CreateSecurityGroupRulePayload) SetEthertype(v CreateSecurityGroupRulePayloadGetEthertypeRetType) { + setCreateSecurityGroupRulePayloadGetEthertypeAttributeType(&o.Ethertype, v) +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetIcmpParameters() (res CreateSecurityGroupRulePayloadGetIcmpParametersRetType) { + res, _ = o.GetIcmpParametersOk() + return +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIcmpParametersOk() (ret CreateSecurityGroupRulePayloadGetIcmpParametersRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetIcmpParametersAttributeTypeOk(o.IcmpParameters) +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasIcmpParameters() bool { + _, ok := o.GetIcmpParametersOk() + return ok +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *CreateSecurityGroupRulePayload) SetIcmpParameters(v CreateSecurityGroupRulePayloadGetIcmpParametersRetType) { + setCreateSecurityGroupRulePayloadGetIcmpParametersAttributeType(&o.IcmpParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetId() (res CreateSecurityGroupRulePayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIdOk() (ret CreateSecurityGroupRulePayloadGetIdRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateSecurityGroupRulePayload) SetId(v CreateSecurityGroupRulePayloadGetIdRetType) { + setCreateSecurityGroupRulePayloadGetIdAttributeType(&o.Id, v) +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetIpRange() (res CreateSecurityGroupRulePayloadGetIpRangeRetType) { + res, _ = o.GetIpRangeOk() + return +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetIpRangeOk() (ret CreateSecurityGroupRulePayloadGetIpRangeRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetIpRangeAttributeTypeOk(o.IpRange) +} + +// HasIpRange returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasIpRange() bool { + _, ok := o.GetIpRangeOk() + return ok +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *CreateSecurityGroupRulePayload) SetIpRange(v CreateSecurityGroupRulePayloadGetIpRangeRetType) { + setCreateSecurityGroupRulePayloadGetIpRangeAttributeType(&o.IpRange, v) +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetPortRange() (res CreateSecurityGroupRulePayloadGetPortRangeRetType) { + res, _ = o.GetPortRangeOk() + return +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetPortRangeOk() (ret CreateSecurityGroupRulePayloadGetPortRangeRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetPortRangeAttributeTypeOk(o.PortRange) +} + +// HasPortRange returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasPortRange() bool { + _, ok := o.GetPortRangeOk() + return ok +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *CreateSecurityGroupRulePayload) SetPortRange(v CreateSecurityGroupRulePayloadGetPortRangeRetType) { + setCreateSecurityGroupRulePayloadGetPortRangeAttributeType(&o.PortRange, v) +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetRemoteSecurityGroupId() (res CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType) { + res, _ = o.GetRemoteSecurityGroupIdOk() + return +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetRemoteSecurityGroupIdOk() (ret CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId) +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasRemoteSecurityGroupId() bool { + _, ok := o.GetRemoteSecurityGroupIdOk() + return ok +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *CreateSecurityGroupRulePayload) SetRemoteSecurityGroupId(v CreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdRetType) { + setCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeType(&o.RemoteSecurityGroupId, v) +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetSecurityGroupId() (res CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType) { + res, _ = o.GetSecurityGroupIdOk() + return +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetSecurityGroupIdOk() (ret CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId) +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasSecurityGroupId() bool { + _, ok := o.GetSecurityGroupIdOk() + return ok +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *CreateSecurityGroupRulePayload) SetSecurityGroupId(v CreateSecurityGroupRulePayloadGetSecurityGroupIdRetType) { + setCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeType(&o.SecurityGroupId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetUpdatedAt() (res CreateSecurityGroupRulePayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetUpdatedAtOk() (ret CreateSecurityGroupRulePayloadGetUpdatedAtRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateSecurityGroupRulePayload) SetUpdatedAt(v CreateSecurityGroupRulePayloadGetUpdatedAtRetType) { + setCreateSecurityGroupRulePayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *CreateSecurityGroupRulePayload) GetProtocol() (res CreateSecurityGroupRulePayloadGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRulePayload) GetProtocolOk() (ret CreateSecurityGroupRulePayloadGetProtocolRetType, ok bool) { + return getCreateSecurityGroupRulePayloadGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *CreateSecurityGroupRulePayload) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given CreateProtocol and assigns it to the Protocol field. +func (o *CreateSecurityGroupRulePayload) SetProtocol(v CreateSecurityGroupRulePayloadGetProtocolRetType) { + setCreateSecurityGroupRulePayloadGetProtocolAttributeType(&o.Protocol, v) +} + +func (o CreateSecurityGroupRulePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSecurityGroupRulePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetDirectionAttributeTypeOk(o.Direction); ok { + toSerialize["Direction"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetEthertypeAttributeTypeOk(o.Ethertype); ok { + toSerialize["Ethertype"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetIcmpParametersAttributeTypeOk(o.IcmpParameters); ok { + toSerialize["IcmpParameters"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetIpRangeAttributeTypeOk(o.IpRange); ok { + toSerialize["IpRange"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetPortRangeAttributeTypeOk(o.PortRange); ok { + toSerialize["PortRange"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId); ok { + toSerialize["RemoteSecurityGroupId"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId); ok { + toSerialize["SecurityGroupId"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getCreateSecurityGroupRulePayloadGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupRulePayload struct { + value *CreateSecurityGroupRulePayload + isSet bool +} + +func (v NullableCreateSecurityGroupRulePayload) Get() *CreateSecurityGroupRulePayload { + return v.value +} + +func (v *NullableCreateSecurityGroupRulePayload) Set(val *CreateSecurityGroupRulePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupRulePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupRulePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupRulePayload(val *CreateSecurityGroupRulePayload) *NullableCreateSecurityGroupRulePayload { + return &NullableCreateSecurityGroupRulePayload{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupRulePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupRulePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_rule_protocol.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_rule_protocol.go new file mode 100644 index 00000000..61cf8537 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_security_group_rule_protocol.go @@ -0,0 +1,127 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateSecurityGroupRuleProtocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSecurityGroupRuleProtocol{} + +/* + types and functions for protocol +*/ + +// isModel +type CreateSecurityGroupRuleProtocolGetProtocolAttributeType = *CreateProtocol +type CreateSecurityGroupRuleProtocolGetProtocolArgType = CreateProtocol +type CreateSecurityGroupRuleProtocolGetProtocolRetType = CreateProtocol + +func getCreateSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(arg CreateSecurityGroupRuleProtocolGetProtocolAttributeType) (ret CreateSecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSecurityGroupRuleProtocolGetProtocolAttributeType(arg *CreateSecurityGroupRuleProtocolGetProtocolAttributeType, val CreateSecurityGroupRuleProtocolGetProtocolRetType) { + *arg = &val +} + +// CreateSecurityGroupRuleProtocol The internet protocol which the rule should match. +type CreateSecurityGroupRuleProtocol struct { + Protocol CreateSecurityGroupRuleProtocolGetProtocolAttributeType `json:"protocol,omitempty"` +} + +// NewCreateSecurityGroupRuleProtocol instantiates a new CreateSecurityGroupRuleProtocol object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSecurityGroupRuleProtocol() *CreateSecurityGroupRuleProtocol { + this := CreateSecurityGroupRuleProtocol{} + return &this +} + +// NewCreateSecurityGroupRuleProtocolWithDefaults instantiates a new CreateSecurityGroupRuleProtocol object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSecurityGroupRuleProtocolWithDefaults() *CreateSecurityGroupRuleProtocol { + this := CreateSecurityGroupRuleProtocol{} + return &this +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *CreateSecurityGroupRuleProtocol) GetProtocol() (res CreateSecurityGroupRuleProtocolGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSecurityGroupRuleProtocol) GetProtocolOk() (ret CreateSecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + return getCreateSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *CreateSecurityGroupRuleProtocol) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given CreateProtocol and assigns it to the Protocol field. +func (o *CreateSecurityGroupRuleProtocol) SetProtocol(v CreateSecurityGroupRuleProtocolGetProtocolRetType) { + setCreateSecurityGroupRuleProtocolGetProtocolAttributeType(&o.Protocol, v) +} + +func (o CreateSecurityGroupRuleProtocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableCreateSecurityGroupRuleProtocol struct { + value *CreateSecurityGroupRuleProtocol + isSet bool +} + +func (v NullableCreateSecurityGroupRuleProtocol) Get() *CreateSecurityGroupRuleProtocol { + return v.value +} + +func (v *NullableCreateSecurityGroupRuleProtocol) Set(val *CreateSecurityGroupRuleProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSecurityGroupRuleProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSecurityGroupRuleProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSecurityGroupRuleProtocol(val *CreateSecurityGroupRuleProtocol) *NullableCreateSecurityGroupRuleProtocol { + return &NullableCreateSecurityGroupRuleProtocol{value: val, isSet: true} +} + +func (v NullableCreateSecurityGroupRuleProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSecurityGroupRuleProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_networking.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_networking.go new file mode 100644 index 00000000..542e6547 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_networking.go @@ -0,0 +1,129 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateServerNetworking type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerNetworking{} + +/* + types and functions for networkId +*/ + +// isNotNullableString +type CreateServerNetworkingGetNetworkIdAttributeType = *string + +func getCreateServerNetworkingGetNetworkIdAttributeTypeOk(arg CreateServerNetworkingGetNetworkIdAttributeType) (ret CreateServerNetworkingGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerNetworkingGetNetworkIdAttributeType(arg *CreateServerNetworkingGetNetworkIdAttributeType, val CreateServerNetworkingGetNetworkIdRetType) { + *arg = &val +} + +type CreateServerNetworkingGetNetworkIdArgType = string +type CreateServerNetworkingGetNetworkIdRetType = string + +// CreateServerNetworking The initial networking setup for the server creation with a network. +type CreateServerNetworking struct { + // Universally Unique Identifier (UUID). + NetworkId CreateServerNetworkingGetNetworkIdAttributeType `json:"networkId,omitempty"` +} + +// NewCreateServerNetworking instantiates a new CreateServerNetworking object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateServerNetworking() *CreateServerNetworking { + this := CreateServerNetworking{} + return &this +} + +// NewCreateServerNetworkingWithDefaults instantiates a new CreateServerNetworking object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateServerNetworkingWithDefaults() *CreateServerNetworking { + this := CreateServerNetworking{} + return &this +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *CreateServerNetworking) GetNetworkId() (res CreateServerNetworkingGetNetworkIdRetType) { + res, _ = o.GetNetworkIdOk() + return +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerNetworking) GetNetworkIdOk() (ret CreateServerNetworkingGetNetworkIdRetType, ok bool) { + return getCreateServerNetworkingGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *CreateServerNetworking) HasNetworkId() bool { + _, ok := o.GetNetworkIdOk() + return ok +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *CreateServerNetworking) SetNetworkId(v CreateServerNetworkingGetNetworkIdRetType) { + setCreateServerNetworkingGetNetworkIdAttributeType(&o.NetworkId, v) +} + +func (o CreateServerNetworking) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerNetworkingGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + return toSerialize, nil +} + +type NullableCreateServerNetworking struct { + value *CreateServerNetworking + isSet bool +} + +func (v NullableCreateServerNetworking) Get() *CreateServerNetworking { + return v.value +} + +func (v *NullableCreateServerNetworking) Set(val *CreateServerNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerNetworking(val *CreateServerNetworking) *NullableCreateServerNetworking { + return &NullableCreateServerNetworking{value: val, isSet: true} +} + +func (v NullableCreateServerNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_networking_with_nics.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_networking_with_nics.go new file mode 100644 index 00000000..adff5ea4 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_networking_with_nics.go @@ -0,0 +1,128 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateServerNetworkingWithNics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerNetworkingWithNics{} + +/* + types and functions for nicIds +*/ + +// isArray +type CreateServerNetworkingWithNicsGetNicIdsAttributeType = *[]string +type CreateServerNetworkingWithNicsGetNicIdsArgType = []string +type CreateServerNetworkingWithNicsGetNicIdsRetType = []string + +func getCreateServerNetworkingWithNicsGetNicIdsAttributeTypeOk(arg CreateServerNetworkingWithNicsGetNicIdsAttributeType) (ret CreateServerNetworkingWithNicsGetNicIdsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerNetworkingWithNicsGetNicIdsAttributeType(arg *CreateServerNetworkingWithNicsGetNicIdsAttributeType, val CreateServerNetworkingWithNicsGetNicIdsRetType) { + *arg = &val +} + +// CreateServerNetworkingWithNics The initial networking setup for the server creation with a network interface. +type CreateServerNetworkingWithNics struct { + // A list of UUIDs. + NicIds CreateServerNetworkingWithNicsGetNicIdsAttributeType `json:"nicIds,omitempty"` +} + +// NewCreateServerNetworkingWithNics instantiates a new CreateServerNetworkingWithNics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateServerNetworkingWithNics() *CreateServerNetworkingWithNics { + this := CreateServerNetworkingWithNics{} + return &this +} + +// NewCreateServerNetworkingWithNicsWithDefaults instantiates a new CreateServerNetworkingWithNics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateServerNetworkingWithNicsWithDefaults() *CreateServerNetworkingWithNics { + this := CreateServerNetworkingWithNics{} + return &this +} + +// GetNicIds returns the NicIds field value if set, zero value otherwise. +func (o *CreateServerNetworkingWithNics) GetNicIds() (res CreateServerNetworkingWithNicsGetNicIdsRetType) { + res, _ = o.GetNicIdsOk() + return +} + +// GetNicIdsOk returns a tuple with the NicIds field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerNetworkingWithNics) GetNicIdsOk() (ret CreateServerNetworkingWithNicsGetNicIdsRetType, ok bool) { + return getCreateServerNetworkingWithNicsGetNicIdsAttributeTypeOk(o.NicIds) +} + +// HasNicIds returns a boolean if a field has been set. +func (o *CreateServerNetworkingWithNics) HasNicIds() bool { + _, ok := o.GetNicIdsOk() + return ok +} + +// SetNicIds gets a reference to the given []string and assigns it to the NicIds field. +func (o *CreateServerNetworkingWithNics) SetNicIds(v CreateServerNetworkingWithNicsGetNicIdsRetType) { + setCreateServerNetworkingWithNicsGetNicIdsAttributeType(&o.NicIds, v) +} + +func (o CreateServerNetworkingWithNics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerNetworkingWithNicsGetNicIdsAttributeTypeOk(o.NicIds); ok { + toSerialize["NicIds"] = val + } + return toSerialize, nil +} + +type NullableCreateServerNetworkingWithNics struct { + value *CreateServerNetworkingWithNics + isSet bool +} + +func (v NullableCreateServerNetworkingWithNics) Get() *CreateServerNetworkingWithNics { + return v.value +} + +func (v *NullableCreateServerNetworkingWithNics) Set(val *CreateServerNetworkingWithNics) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerNetworkingWithNics) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerNetworkingWithNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerNetworkingWithNics(val *CreateServerNetworkingWithNics) *NullableCreateServerNetworkingWithNics { + return &NullableCreateServerNetworkingWithNics{value: val, isSet: true} +} + +func (v NullableCreateServerNetworkingWithNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerNetworkingWithNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload.go new file mode 100644 index 00000000..2e38fd19 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload.go @@ -0,0 +1,1229 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerPayload{} + +/* + types and functions for affinityGroup +*/ + +// isNotNullableString +type CreateServerPayloadGetAffinityGroupAttributeType = *string + +func getCreateServerPayloadGetAffinityGroupAttributeTypeOk(arg CreateServerPayloadGetAffinityGroupAttributeType) (ret CreateServerPayloadGetAffinityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetAffinityGroupAttributeType(arg *CreateServerPayloadGetAffinityGroupAttributeType, val CreateServerPayloadGetAffinityGroupRetType) { + *arg = &val +} + +type CreateServerPayloadGetAffinityGroupArgType = string +type CreateServerPayloadGetAffinityGroupRetType = string + +/* + types and functions for agent +*/ + +// isModel +type CreateServerPayloadGetAgentAttributeType = *ServerAgent +type CreateServerPayloadGetAgentArgType = ServerAgent +type CreateServerPayloadGetAgentRetType = ServerAgent + +func getCreateServerPayloadGetAgentAttributeTypeOk(arg CreateServerPayloadGetAgentAttributeType) (ret CreateServerPayloadGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetAgentAttributeType(arg *CreateServerPayloadGetAgentAttributeType, val CreateServerPayloadGetAgentRetType) { + *arg = &val +} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type CreateServerPayloadGetAvailabilityZoneAttributeType = *string + +func getCreateServerPayloadGetAvailabilityZoneAttributeTypeOk(arg CreateServerPayloadGetAvailabilityZoneAttributeType) (ret CreateServerPayloadGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetAvailabilityZoneAttributeType(arg *CreateServerPayloadGetAvailabilityZoneAttributeType, val CreateServerPayloadGetAvailabilityZoneRetType) { + *arg = &val +} + +type CreateServerPayloadGetAvailabilityZoneArgType = string +type CreateServerPayloadGetAvailabilityZoneRetType = string + +/* + types and functions for bootVolume +*/ + +// isModel +type CreateServerPayloadGetBootVolumeAttributeType = *ServerBootVolume +type CreateServerPayloadGetBootVolumeArgType = ServerBootVolume +type CreateServerPayloadGetBootVolumeRetType = ServerBootVolume + +func getCreateServerPayloadGetBootVolumeAttributeTypeOk(arg CreateServerPayloadGetBootVolumeAttributeType) (ret CreateServerPayloadGetBootVolumeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetBootVolumeAttributeType(arg *CreateServerPayloadGetBootVolumeAttributeType, val CreateServerPayloadGetBootVolumeRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateServerPayloadGetCreatedAtAttributeType = *time.Time +type CreateServerPayloadGetCreatedAtArgType = time.Time +type CreateServerPayloadGetCreatedAtRetType = time.Time + +func getCreateServerPayloadGetCreatedAtAttributeTypeOk(arg CreateServerPayloadGetCreatedAtAttributeType) (ret CreateServerPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetCreatedAtAttributeType(arg *CreateServerPayloadGetCreatedAtAttributeType, val CreateServerPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for errorMessage +*/ + +// isNotNullableString +type CreateServerPayloadGetErrorMessageAttributeType = *string + +func getCreateServerPayloadGetErrorMessageAttributeTypeOk(arg CreateServerPayloadGetErrorMessageAttributeType) (ret CreateServerPayloadGetErrorMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetErrorMessageAttributeType(arg *CreateServerPayloadGetErrorMessageAttributeType, val CreateServerPayloadGetErrorMessageRetType) { + *arg = &val +} + +type CreateServerPayloadGetErrorMessageArgType = string +type CreateServerPayloadGetErrorMessageRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateServerPayloadGetIdAttributeType = *string + +func getCreateServerPayloadGetIdAttributeTypeOk(arg CreateServerPayloadGetIdAttributeType) (ret CreateServerPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetIdAttributeType(arg *CreateServerPayloadGetIdAttributeType, val CreateServerPayloadGetIdRetType) { + *arg = &val +} + +type CreateServerPayloadGetIdArgType = string +type CreateServerPayloadGetIdRetType = string + +/* + types and functions for imageId +*/ + +// isNotNullableString +type CreateServerPayloadGetImageIdAttributeType = *string + +func getCreateServerPayloadGetImageIdAttributeTypeOk(arg CreateServerPayloadGetImageIdAttributeType) (ret CreateServerPayloadGetImageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetImageIdAttributeType(arg *CreateServerPayloadGetImageIdAttributeType, val CreateServerPayloadGetImageIdRetType) { + *arg = &val +} + +type CreateServerPayloadGetImageIdArgType = string +type CreateServerPayloadGetImageIdRetType = string + +/* + types and functions for keypairName +*/ + +// isNotNullableString +type CreateServerPayloadGetKeypairNameAttributeType = *string + +func getCreateServerPayloadGetKeypairNameAttributeTypeOk(arg CreateServerPayloadGetKeypairNameAttributeType) (ret CreateServerPayloadGetKeypairNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetKeypairNameAttributeType(arg *CreateServerPayloadGetKeypairNameAttributeType, val CreateServerPayloadGetKeypairNameRetType) { + *arg = &val +} + +type CreateServerPayloadGetKeypairNameArgType = string +type CreateServerPayloadGetKeypairNameRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateServerPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateServerPayloadGetLabelsArgType = map[string]interface{} +type CreateServerPayloadGetLabelsRetType = map[string]interface{} + +func getCreateServerPayloadGetLabelsAttributeTypeOk(arg CreateServerPayloadGetLabelsAttributeType) (ret CreateServerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetLabelsAttributeType(arg *CreateServerPayloadGetLabelsAttributeType, val CreateServerPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for launchedAt +*/ + +// isDateTime +type CreateServerPayloadGetLaunchedAtAttributeType = *time.Time +type CreateServerPayloadGetLaunchedAtArgType = time.Time +type CreateServerPayloadGetLaunchedAtRetType = time.Time + +func getCreateServerPayloadGetLaunchedAtAttributeTypeOk(arg CreateServerPayloadGetLaunchedAtAttributeType) (ret CreateServerPayloadGetLaunchedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetLaunchedAtAttributeType(arg *CreateServerPayloadGetLaunchedAtAttributeType, val CreateServerPayloadGetLaunchedAtRetType) { + *arg = &val +} + +/* + types and functions for machineType +*/ + +// isNotNullableString +type CreateServerPayloadGetMachineTypeAttributeType = *string + +func getCreateServerPayloadGetMachineTypeAttributeTypeOk(arg CreateServerPayloadGetMachineTypeAttributeType) (ret CreateServerPayloadGetMachineTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetMachineTypeAttributeType(arg *CreateServerPayloadGetMachineTypeAttributeType, val CreateServerPayloadGetMachineTypeRetType) { + *arg = &val +} + +type CreateServerPayloadGetMachineTypeArgType = string +type CreateServerPayloadGetMachineTypeRetType = string + +/* + types and functions for maintenanceWindow +*/ + +// isModel +type CreateServerPayloadGetMaintenanceWindowAttributeType = *ServerMaintenance +type CreateServerPayloadGetMaintenanceWindowArgType = ServerMaintenance +type CreateServerPayloadGetMaintenanceWindowRetType = ServerMaintenance + +func getCreateServerPayloadGetMaintenanceWindowAttributeTypeOk(arg CreateServerPayloadGetMaintenanceWindowAttributeType) (ret CreateServerPayloadGetMaintenanceWindowRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetMaintenanceWindowAttributeType(arg *CreateServerPayloadGetMaintenanceWindowAttributeType, val CreateServerPayloadGetMaintenanceWindowRetType) { + *arg = &val +} + +/* + types and functions for metadata +*/ + +// isFreeform +type CreateServerPayloadGetMetadataAttributeType = *map[string]interface{} +type CreateServerPayloadGetMetadataArgType = map[string]interface{} +type CreateServerPayloadGetMetadataRetType = map[string]interface{} + +func getCreateServerPayloadGetMetadataAttributeTypeOk(arg CreateServerPayloadGetMetadataAttributeType) (ret CreateServerPayloadGetMetadataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetMetadataAttributeType(arg *CreateServerPayloadGetMetadataAttributeType, val CreateServerPayloadGetMetadataRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateServerPayloadGetNameAttributeType = *string + +func getCreateServerPayloadGetNameAttributeTypeOk(arg CreateServerPayloadGetNameAttributeType) (ret CreateServerPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetNameAttributeType(arg *CreateServerPayloadGetNameAttributeType, val CreateServerPayloadGetNameRetType) { + *arg = &val +} + +type CreateServerPayloadGetNameArgType = string +type CreateServerPayloadGetNameRetType = string + +/* + types and functions for networking +*/ + +// isModel +type CreateServerPayloadGetNetworkingAttributeType = *CreateServerPayloadAllOfNetworking +type CreateServerPayloadGetNetworkingArgType = CreateServerPayloadAllOfNetworking +type CreateServerPayloadGetNetworkingRetType = CreateServerPayloadAllOfNetworking + +func getCreateServerPayloadGetNetworkingAttributeTypeOk(arg CreateServerPayloadGetNetworkingAttributeType) (ret CreateServerPayloadGetNetworkingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetNetworkingAttributeType(arg *CreateServerPayloadGetNetworkingAttributeType, val CreateServerPayloadGetNetworkingRetType) { + *arg = &val +} + +/* + types and functions for nics +*/ + +// isArray +type CreateServerPayloadGetNicsAttributeType = *[]ServerNetwork +type CreateServerPayloadGetNicsArgType = []ServerNetwork +type CreateServerPayloadGetNicsRetType = []ServerNetwork + +func getCreateServerPayloadGetNicsAttributeTypeOk(arg CreateServerPayloadGetNicsAttributeType) (ret CreateServerPayloadGetNicsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetNicsAttributeType(arg *CreateServerPayloadGetNicsAttributeType, val CreateServerPayloadGetNicsRetType) { + *arg = &val +} + +/* + types and functions for powerStatus +*/ + +// isNotNullableString +type CreateServerPayloadGetPowerStatusAttributeType = *string + +func getCreateServerPayloadGetPowerStatusAttributeTypeOk(arg CreateServerPayloadGetPowerStatusAttributeType) (ret CreateServerPayloadGetPowerStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetPowerStatusAttributeType(arg *CreateServerPayloadGetPowerStatusAttributeType, val CreateServerPayloadGetPowerStatusRetType) { + *arg = &val +} + +type CreateServerPayloadGetPowerStatusArgType = string +type CreateServerPayloadGetPowerStatusRetType = string + +/* + types and functions for securityGroups +*/ + +// isArray +type CreateServerPayloadGetSecurityGroupsAttributeType = *[]string +type CreateServerPayloadGetSecurityGroupsArgType = []string +type CreateServerPayloadGetSecurityGroupsRetType = []string + +func getCreateServerPayloadGetSecurityGroupsAttributeTypeOk(arg CreateServerPayloadGetSecurityGroupsAttributeType) (ret CreateServerPayloadGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetSecurityGroupsAttributeType(arg *CreateServerPayloadGetSecurityGroupsAttributeType, val CreateServerPayloadGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for serviceAccountMails +*/ + +// isArray +type CreateServerPayloadGetServiceAccountMailsAttributeType = *[]string +type CreateServerPayloadGetServiceAccountMailsArgType = []string +type CreateServerPayloadGetServiceAccountMailsRetType = []string + +func getCreateServerPayloadGetServiceAccountMailsAttributeTypeOk(arg CreateServerPayloadGetServiceAccountMailsAttributeType) (ret CreateServerPayloadGetServiceAccountMailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetServiceAccountMailsAttributeType(arg *CreateServerPayloadGetServiceAccountMailsAttributeType, val CreateServerPayloadGetServiceAccountMailsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateServerPayloadGetStatusAttributeType = *string + +func getCreateServerPayloadGetStatusAttributeTypeOk(arg CreateServerPayloadGetStatusAttributeType) (ret CreateServerPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetStatusAttributeType(arg *CreateServerPayloadGetStatusAttributeType, val CreateServerPayloadGetStatusRetType) { + *arg = &val +} + +type CreateServerPayloadGetStatusArgType = string +type CreateServerPayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateServerPayloadGetUpdatedAtAttributeType = *time.Time +type CreateServerPayloadGetUpdatedAtArgType = time.Time +type CreateServerPayloadGetUpdatedAtRetType = time.Time + +func getCreateServerPayloadGetUpdatedAtAttributeTypeOk(arg CreateServerPayloadGetUpdatedAtAttributeType) (ret CreateServerPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetUpdatedAtAttributeType(arg *CreateServerPayloadGetUpdatedAtAttributeType, val CreateServerPayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for userData +*/ + +// isByteArray +type CreateServerPayloadGetUserDataAttributeType = *[]byte +type CreateServerPayloadGetUserDataArgType = []byte +type CreateServerPayloadGetUserDataRetType = []byte + +func getCreateServerPayloadGetUserDataAttributeTypeOk(arg CreateServerPayloadGetUserDataAttributeType) (ret CreateServerPayloadGetUserDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetUserDataAttributeType(arg *CreateServerPayloadGetUserDataAttributeType, val CreateServerPayloadGetUserDataRetType) { + *arg = &val +} + +/* + types and functions for volumes +*/ + +// isArray +type CreateServerPayloadGetVolumesAttributeType = *[]string +type CreateServerPayloadGetVolumesArgType = []string +type CreateServerPayloadGetVolumesRetType = []string + +func getCreateServerPayloadGetVolumesAttributeTypeOk(arg CreateServerPayloadGetVolumesAttributeType) (ret CreateServerPayloadGetVolumesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadGetVolumesAttributeType(arg *CreateServerPayloadGetVolumesAttributeType, val CreateServerPayloadGetVolumesRetType) { + *arg = &val +} + +// CreateServerPayload Object that represents the request body for a server create. +type CreateServerPayload struct { + // Universally Unique Identifier (UUID). + AffinityGroup CreateServerPayloadGetAffinityGroupAttributeType `json:"affinityGroup,omitempty"` + Agent CreateServerPayloadGetAgentAttributeType `json:"agent,omitempty"` + // Object that represents an availability zone. + AvailabilityZone CreateServerPayloadGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + BootVolume CreateServerPayloadGetBootVolumeAttributeType `json:"bootVolume,omitempty"` + // Date-time when resource was created. + CreatedAt CreateServerPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // An error message. + ErrorMessage CreateServerPayloadGetErrorMessageAttributeType `json:"errorMessage,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateServerPayloadGetIdAttributeType `json:"id,omitempty"` + // Universally Unique Identifier (UUID). + ImageId CreateServerPayloadGetImageIdAttributeType `json:"imageId,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + KeypairName CreateServerPayloadGetKeypairNameAttributeType `json:"keypairName,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateServerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Date-time when resource was launched. + LaunchedAt CreateServerPayloadGetLaunchedAtAttributeType `json:"launchedAt,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType CreateServerPayloadGetMachineTypeAttributeType `json:"machineType" required:"true"` + MaintenanceWindow CreateServerPayloadGetMaintenanceWindowAttributeType `json:"maintenanceWindow,omitempty"` + // Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value for a key will remove that key. + Metadata CreateServerPayloadGetMetadataAttributeType `json:"metadata,omitempty"` + // The name for a Server. + // REQUIRED + Name CreateServerPayloadGetNameAttributeType `json:"name" required:"true"` + // REQUIRED + Networking CreateServerPayloadGetNetworkingAttributeType `json:"networking" required:"true"` + // A list of networks attached to a server. + Nics CreateServerPayloadGetNicsAttributeType `json:"nics,omitempty"` + // The power status of a server. Possible values: `CRASHED`, `ERROR`, `RUNNING`, `STOPPED`. + PowerStatus CreateServerPayloadGetPowerStatusAttributeType `json:"powerStatus,omitempty"` + // A list of General Objects. + SecurityGroups CreateServerPayloadGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // A list of service account mails. + ServiceAccountMails CreateServerPayloadGetServiceAccountMailsAttributeType `json:"serviceAccountMails,omitempty"` + // The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, `UNRESCUING`, `UPDATING`. + Status CreateServerPayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateServerPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init to the server. + UserData CreateServerPayloadGetUserDataAttributeType `json:"userData,omitempty"` + // A list of UUIDs. + Volumes CreateServerPayloadGetVolumesAttributeType `json:"volumes,omitempty"` +} + +type _CreateServerPayload CreateServerPayload + +// NewCreateServerPayload instantiates a new CreateServerPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateServerPayload(machineType CreateServerPayloadGetMachineTypeArgType, name CreateServerPayloadGetNameArgType, networking CreateServerPayloadGetNetworkingArgType) *CreateServerPayload { + this := CreateServerPayload{} + setCreateServerPayloadGetMachineTypeAttributeType(&this.MachineType, machineType) + setCreateServerPayloadGetNameAttributeType(&this.Name, name) + setCreateServerPayloadGetNetworkingAttributeType(&this.Networking, networking) + return &this +} + +// NewCreateServerPayloadWithDefaults instantiates a new CreateServerPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateServerPayloadWithDefaults() *CreateServerPayload { + this := CreateServerPayload{} + return &this +} + +// GetAffinityGroup returns the AffinityGroup field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAffinityGroup() (res CreateServerPayloadGetAffinityGroupRetType) { + res, _ = o.GetAffinityGroupOk() + return +} + +// GetAffinityGroupOk returns a tuple with the AffinityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAffinityGroupOk() (ret CreateServerPayloadGetAffinityGroupRetType, ok bool) { + return getCreateServerPayloadGetAffinityGroupAttributeTypeOk(o.AffinityGroup) +} + +// HasAffinityGroup returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAffinityGroup() bool { + _, ok := o.GetAffinityGroupOk() + return ok +} + +// SetAffinityGroup gets a reference to the given string and assigns it to the AffinityGroup field. +func (o *CreateServerPayload) SetAffinityGroup(v CreateServerPayloadGetAffinityGroupRetType) { + setCreateServerPayloadGetAffinityGroupAttributeType(&o.AffinityGroup, v) +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAgent() (res CreateServerPayloadGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAgentOk() (ret CreateServerPayloadGetAgentRetType, ok bool) { + return getCreateServerPayloadGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ServerAgent and assigns it to the Agent field. +func (o *CreateServerPayload) SetAgent(v CreateServerPayloadGetAgentRetType) { + setCreateServerPayloadGetAgentAttributeType(&o.Agent, v) +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *CreateServerPayload) GetAvailabilityZone() (res CreateServerPayloadGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetAvailabilityZoneOk() (ret CreateServerPayloadGetAvailabilityZoneRetType, ok bool) { + return getCreateServerPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *CreateServerPayload) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *CreateServerPayload) SetAvailabilityZone(v CreateServerPayloadGetAvailabilityZoneRetType) { + setCreateServerPayloadGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootVolume returns the BootVolume field value if set, zero value otherwise. +func (o *CreateServerPayload) GetBootVolume() (res CreateServerPayloadGetBootVolumeRetType) { + res, _ = o.GetBootVolumeOk() + return +} + +// GetBootVolumeOk returns a tuple with the BootVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetBootVolumeOk() (ret CreateServerPayloadGetBootVolumeRetType, ok bool) { + return getCreateServerPayloadGetBootVolumeAttributeTypeOk(o.BootVolume) +} + +// HasBootVolume returns a boolean if a field has been set. +func (o *CreateServerPayload) HasBootVolume() bool { + _, ok := o.GetBootVolumeOk() + return ok +} + +// SetBootVolume gets a reference to the given ServerBootVolume and assigns it to the BootVolume field. +func (o *CreateServerPayload) SetBootVolume(v CreateServerPayloadGetBootVolumeRetType) { + setCreateServerPayloadGetBootVolumeAttributeType(&o.BootVolume, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) GetCreatedAt() (res CreateServerPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetCreatedAtOk() (ret CreateServerPayloadGetCreatedAtRetType, ok bool) { + return getCreateServerPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateServerPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateServerPayload) SetCreatedAt(v CreateServerPayloadGetCreatedAtRetType) { + setCreateServerPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *CreateServerPayload) GetErrorMessage() (res CreateServerPayloadGetErrorMessageRetType) { + res, _ = o.GetErrorMessageOk() + return +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetErrorMessageOk() (ret CreateServerPayloadGetErrorMessageRetType, ok bool) { + return getCreateServerPayloadGetErrorMessageAttributeTypeOk(o.ErrorMessage) +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *CreateServerPayload) HasErrorMessage() bool { + _, ok := o.GetErrorMessageOk() + return ok +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *CreateServerPayload) SetErrorMessage(v CreateServerPayloadGetErrorMessageRetType) { + setCreateServerPayloadGetErrorMessageAttributeType(&o.ErrorMessage, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateServerPayload) GetId() (res CreateServerPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetIdOk() (ret CreateServerPayloadGetIdRetType, ok bool) { + return getCreateServerPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateServerPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateServerPayload) SetId(v CreateServerPayloadGetIdRetType) { + setCreateServerPayloadGetIdAttributeType(&o.Id, v) +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *CreateServerPayload) GetImageId() (res CreateServerPayloadGetImageIdRetType) { + res, _ = o.GetImageIdOk() + return +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetImageIdOk() (ret CreateServerPayloadGetImageIdRetType, ok bool) { + return getCreateServerPayloadGetImageIdAttributeTypeOk(o.ImageId) +} + +// HasImageId returns a boolean if a field has been set. +func (o *CreateServerPayload) HasImageId() bool { + _, ok := o.GetImageIdOk() + return ok +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *CreateServerPayload) SetImageId(v CreateServerPayloadGetImageIdRetType) { + setCreateServerPayloadGetImageIdAttributeType(&o.ImageId, v) +} + +// GetKeypairName returns the KeypairName field value if set, zero value otherwise. +func (o *CreateServerPayload) GetKeypairName() (res CreateServerPayloadGetKeypairNameRetType) { + res, _ = o.GetKeypairNameOk() + return +} + +// GetKeypairNameOk returns a tuple with the KeypairName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetKeypairNameOk() (ret CreateServerPayloadGetKeypairNameRetType, ok bool) { + return getCreateServerPayloadGetKeypairNameAttributeTypeOk(o.KeypairName) +} + +// HasKeypairName returns a boolean if a field has been set. +func (o *CreateServerPayload) HasKeypairName() bool { + _, ok := o.GetKeypairNameOk() + return ok +} + +// SetKeypairName gets a reference to the given string and assigns it to the KeypairName field. +func (o *CreateServerPayload) SetKeypairName(v CreateServerPayloadGetKeypairNameRetType) { + setCreateServerPayloadGetKeypairNameAttributeType(&o.KeypairName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateServerPayload) GetLabels() (res CreateServerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetLabelsOk() (ret CreateServerPayloadGetLabelsRetType, ok bool) { + return getCreateServerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateServerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateServerPayload) SetLabels(v CreateServerPayloadGetLabelsRetType) { + setCreateServerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetLaunchedAt returns the LaunchedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) GetLaunchedAt() (res CreateServerPayloadGetLaunchedAtRetType) { + res, _ = o.GetLaunchedAtOk() + return +} + +// GetLaunchedAtOk returns a tuple with the LaunchedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetLaunchedAtOk() (ret CreateServerPayloadGetLaunchedAtRetType, ok bool) { + return getCreateServerPayloadGetLaunchedAtAttributeTypeOk(o.LaunchedAt) +} + +// HasLaunchedAt returns a boolean if a field has been set. +func (o *CreateServerPayload) HasLaunchedAt() bool { + _, ok := o.GetLaunchedAtOk() + return ok +} + +// SetLaunchedAt gets a reference to the given time.Time and assigns it to the LaunchedAt field. +func (o *CreateServerPayload) SetLaunchedAt(v CreateServerPayloadGetLaunchedAtRetType) { + setCreateServerPayloadGetLaunchedAtAttributeType(&o.LaunchedAt, v) +} + +// GetMachineType returns the MachineType field value +func (o *CreateServerPayload) GetMachineType() (ret CreateServerPayloadGetMachineTypeRetType) { + ret, _ = o.GetMachineTypeOk() + return ret +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMachineTypeOk() (ret CreateServerPayloadGetMachineTypeRetType, ok bool) { + return getCreateServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType) +} + +// SetMachineType sets field value +func (o *CreateServerPayload) SetMachineType(v CreateServerPayloadGetMachineTypeRetType) { + setCreateServerPayloadGetMachineTypeAttributeType(&o.MachineType, v) +} + +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *CreateServerPayload) GetMaintenanceWindow() (res CreateServerPayloadGetMaintenanceWindowRetType) { + res, _ = o.GetMaintenanceWindowOk() + return +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMaintenanceWindowOk() (ret CreateServerPayloadGetMaintenanceWindowRetType, ok bool) { + return getCreateServerPayloadGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow) +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *CreateServerPayload) HasMaintenanceWindow() bool { + _, ok := o.GetMaintenanceWindowOk() + return ok +} + +// SetMaintenanceWindow gets a reference to the given ServerMaintenance and assigns it to the MaintenanceWindow field. +func (o *CreateServerPayload) SetMaintenanceWindow(v CreateServerPayloadGetMaintenanceWindowRetType) { + setCreateServerPayloadGetMaintenanceWindowAttributeType(&o.MaintenanceWindow, v) +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *CreateServerPayload) GetMetadata() (res CreateServerPayloadGetMetadataRetType) { + res, _ = o.GetMetadataOk() + return +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetMetadataOk() (ret CreateServerPayloadGetMetadataRetType, ok bool) { + return getCreateServerPayloadGetMetadataAttributeTypeOk(o.Metadata) +} + +// HasMetadata returns a boolean if a field has been set. +func (o *CreateServerPayload) HasMetadata() bool { + _, ok := o.GetMetadataOk() + return ok +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *CreateServerPayload) SetMetadata(v CreateServerPayloadGetMetadataRetType) { + setCreateServerPayloadGetMetadataAttributeType(&o.Metadata, v) +} + +// GetName returns the Name field value +func (o *CreateServerPayload) GetName() (ret CreateServerPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNameOk() (ret CreateServerPayloadGetNameRetType, ok bool) { + return getCreateServerPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateServerPayload) SetName(v CreateServerPayloadGetNameRetType) { + setCreateServerPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNetworking returns the Networking field value +func (o *CreateServerPayload) GetNetworking() (ret CreateServerPayloadGetNetworkingRetType) { + ret, _ = o.GetNetworkingOk() + return ret +} + +// GetNetworkingOk returns a tuple with the Networking field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNetworkingOk() (ret CreateServerPayloadGetNetworkingRetType, ok bool) { + return getCreateServerPayloadGetNetworkingAttributeTypeOk(o.Networking) +} + +// SetNetworking sets field value +func (o *CreateServerPayload) SetNetworking(v CreateServerPayloadGetNetworkingRetType) { + setCreateServerPayloadGetNetworkingAttributeType(&o.Networking, v) +} + +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *CreateServerPayload) GetNics() (res CreateServerPayloadGetNicsRetType) { + res, _ = o.GetNicsOk() + return +} + +// GetNicsOk returns a tuple with the Nics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetNicsOk() (ret CreateServerPayloadGetNicsRetType, ok bool) { + return getCreateServerPayloadGetNicsAttributeTypeOk(o.Nics) +} + +// HasNics returns a boolean if a field has been set. +func (o *CreateServerPayload) HasNics() bool { + _, ok := o.GetNicsOk() + return ok +} + +// SetNics gets a reference to the given []ServerNetwork and assigns it to the Nics field. +func (o *CreateServerPayload) SetNics(v CreateServerPayloadGetNicsRetType) { + setCreateServerPayloadGetNicsAttributeType(&o.Nics, v) +} + +// GetPowerStatus returns the PowerStatus field value if set, zero value otherwise. +func (o *CreateServerPayload) GetPowerStatus() (res CreateServerPayloadGetPowerStatusRetType) { + res, _ = o.GetPowerStatusOk() + return +} + +// GetPowerStatusOk returns a tuple with the PowerStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetPowerStatusOk() (ret CreateServerPayloadGetPowerStatusRetType, ok bool) { + return getCreateServerPayloadGetPowerStatusAttributeTypeOk(o.PowerStatus) +} + +// HasPowerStatus returns a boolean if a field has been set. +func (o *CreateServerPayload) HasPowerStatus() bool { + _, ok := o.GetPowerStatusOk() + return ok +} + +// SetPowerStatus gets a reference to the given string and assigns it to the PowerStatus field. +func (o *CreateServerPayload) SetPowerStatus(v CreateServerPayloadGetPowerStatusRetType) { + setCreateServerPayloadGetPowerStatusAttributeType(&o.PowerStatus, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *CreateServerPayload) GetSecurityGroups() (res CreateServerPayloadGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetSecurityGroupsOk() (ret CreateServerPayloadGetSecurityGroupsRetType, ok bool) { + return getCreateServerPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *CreateServerPayload) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *CreateServerPayload) SetSecurityGroups(v CreateServerPayloadGetSecurityGroupsRetType) { + setCreateServerPayloadGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetServiceAccountMails returns the ServiceAccountMails field value if set, zero value otherwise. +func (o *CreateServerPayload) GetServiceAccountMails() (res CreateServerPayloadGetServiceAccountMailsRetType) { + res, _ = o.GetServiceAccountMailsOk() + return +} + +// GetServiceAccountMailsOk returns a tuple with the ServiceAccountMails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetServiceAccountMailsOk() (ret CreateServerPayloadGetServiceAccountMailsRetType, ok bool) { + return getCreateServerPayloadGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails) +} + +// HasServiceAccountMails returns a boolean if a field has been set. +func (o *CreateServerPayload) HasServiceAccountMails() bool { + _, ok := o.GetServiceAccountMailsOk() + return ok +} + +// SetServiceAccountMails gets a reference to the given []string and assigns it to the ServiceAccountMails field. +func (o *CreateServerPayload) SetServiceAccountMails(v CreateServerPayloadGetServiceAccountMailsRetType) { + setCreateServerPayloadGetServiceAccountMailsAttributeType(&o.ServiceAccountMails, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateServerPayload) GetStatus() (res CreateServerPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetStatusOk() (ret CreateServerPayloadGetStatusRetType, ok bool) { + return getCreateServerPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateServerPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateServerPayload) SetStatus(v CreateServerPayloadGetStatusRetType) { + setCreateServerPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateServerPayload) GetUpdatedAt() (res CreateServerPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetUpdatedAtOk() (ret CreateServerPayloadGetUpdatedAtRetType, ok bool) { + return getCreateServerPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateServerPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateServerPayload) SetUpdatedAt(v CreateServerPayloadGetUpdatedAtRetType) { + setCreateServerPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetUserData returns the UserData field value if set, zero value otherwise. +func (o *CreateServerPayload) GetUserData() (res CreateServerPayloadGetUserDataRetType) { + res, _ = o.GetUserDataOk() + return +} + +// GetUserDataOk returns a tuple with the UserData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetUserDataOk() (ret CreateServerPayloadGetUserDataRetType, ok bool) { + return getCreateServerPayloadGetUserDataAttributeTypeOk(o.UserData) +} + +// HasUserData returns a boolean if a field has been set. +func (o *CreateServerPayload) HasUserData() bool { + _, ok := o.GetUserDataOk() + return ok +} + +// SetUserData gets a reference to the given string and assigns it to the UserData field. +func (o *CreateServerPayload) SetUserData(v CreateServerPayloadGetUserDataRetType) { + setCreateServerPayloadGetUserDataAttributeType(&o.UserData, v) +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *CreateServerPayload) GetVolumes() (res CreateServerPayloadGetVolumesRetType) { + res, _ = o.GetVolumesOk() + return +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayload) GetVolumesOk() (ret CreateServerPayloadGetVolumesRetType, ok bool) { + return getCreateServerPayloadGetVolumesAttributeTypeOk(o.Volumes) +} + +// HasVolumes returns a boolean if a field has been set. +func (o *CreateServerPayload) HasVolumes() bool { + _, ok := o.GetVolumesOk() + return ok +} + +// SetVolumes gets a reference to the given []string and assigns it to the Volumes field. +func (o *CreateServerPayload) SetVolumes(v CreateServerPayloadGetVolumesRetType) { + setCreateServerPayloadGetVolumesAttributeType(&o.Volumes, v) +} + +func (o CreateServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerPayloadGetAffinityGroupAttributeTypeOk(o.AffinityGroup); ok { + toSerialize["AffinityGroup"] = val + } + if val, ok := getCreateServerPayloadGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getCreateServerPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getCreateServerPayloadGetBootVolumeAttributeTypeOk(o.BootVolume); ok { + toSerialize["BootVolume"] = val + } + if val, ok := getCreateServerPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateServerPayloadGetErrorMessageAttributeTypeOk(o.ErrorMessage); ok { + toSerialize["ErrorMessage"] = val + } + if val, ok := getCreateServerPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateServerPayloadGetImageIdAttributeTypeOk(o.ImageId); ok { + toSerialize["ImageId"] = val + } + if val, ok := getCreateServerPayloadGetKeypairNameAttributeTypeOk(o.KeypairName); ok { + toSerialize["KeypairName"] = val + } + if val, ok := getCreateServerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateServerPayloadGetLaunchedAtAttributeTypeOk(o.LaunchedAt); ok { + toSerialize["LaunchedAt"] = val + } + if val, ok := getCreateServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType); ok { + toSerialize["MachineType"] = val + } + if val, ok := getCreateServerPayloadGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow); ok { + toSerialize["MaintenanceWindow"] = val + } + if val, ok := getCreateServerPayloadGetMetadataAttributeTypeOk(o.Metadata); ok { + toSerialize["Metadata"] = val + } + if val, ok := getCreateServerPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateServerPayloadGetNetworkingAttributeTypeOk(o.Networking); ok { + toSerialize["Networking"] = val + } + if val, ok := getCreateServerPayloadGetNicsAttributeTypeOk(o.Nics); ok { + toSerialize["Nics"] = val + } + if val, ok := getCreateServerPayloadGetPowerStatusAttributeTypeOk(o.PowerStatus); ok { + toSerialize["PowerStatus"] = val + } + if val, ok := getCreateServerPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getCreateServerPayloadGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails); ok { + toSerialize["ServiceAccountMails"] = val + } + if val, ok := getCreateServerPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateServerPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getCreateServerPayloadGetUserDataAttributeTypeOk(o.UserData); ok { + toSerialize["UserData"] = val + } + if val, ok := getCreateServerPayloadGetVolumesAttributeTypeOk(o.Volumes); ok { + toSerialize["Volumes"] = val + } + return toSerialize, nil +} + +type NullableCreateServerPayload struct { + value *CreateServerPayload + isSet bool +} + +func (v NullableCreateServerPayload) Get() *CreateServerPayload { + return v.value +} + +func (v *NullableCreateServerPayload) Set(val *CreateServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayload(val *CreateServerPayload) *NullableCreateServerPayload { + return &NullableCreateServerPayload{value: val, isSet: true} +} + +func (v NullableCreateServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_all_of.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_all_of.go new file mode 100644 index 00000000..e992961b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_all_of.go @@ -0,0 +1,125 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateServerPayloadAllOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerPayloadAllOf{} + +/* + types and functions for networking +*/ + +// isModel +type CreateServerPayloadAllOfGetNetworkingAttributeType = *CreateServerPayloadAllOfNetworking +type CreateServerPayloadAllOfGetNetworkingArgType = CreateServerPayloadAllOfNetworking +type CreateServerPayloadAllOfGetNetworkingRetType = CreateServerPayloadAllOfNetworking + +func getCreateServerPayloadAllOfGetNetworkingAttributeTypeOk(arg CreateServerPayloadAllOfGetNetworkingAttributeType) (ret CreateServerPayloadAllOfGetNetworkingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadAllOfGetNetworkingAttributeType(arg *CreateServerPayloadAllOfGetNetworkingAttributeType, val CreateServerPayloadAllOfGetNetworkingRetType) { + *arg = &val +} + +// CreateServerPayloadAllOf struct for CreateServerPayloadAllOf +type CreateServerPayloadAllOf struct { + // REQUIRED + Networking CreateServerPayloadAllOfGetNetworkingAttributeType `json:"networking" required:"true"` +} + +type _CreateServerPayloadAllOf CreateServerPayloadAllOf + +// NewCreateServerPayloadAllOf instantiates a new CreateServerPayloadAllOf object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateServerPayloadAllOf(networking CreateServerPayloadAllOfGetNetworkingArgType) *CreateServerPayloadAllOf { + this := CreateServerPayloadAllOf{} + setCreateServerPayloadAllOfGetNetworkingAttributeType(&this.Networking, networking) + return &this +} + +// NewCreateServerPayloadAllOfWithDefaults instantiates a new CreateServerPayloadAllOf object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateServerPayloadAllOfWithDefaults() *CreateServerPayloadAllOf { + this := CreateServerPayloadAllOf{} + return &this +} + +// GetNetworking returns the Networking field value +func (o *CreateServerPayloadAllOf) GetNetworking() (ret CreateServerPayloadAllOfGetNetworkingRetType) { + ret, _ = o.GetNetworkingOk() + return ret +} + +// GetNetworkingOk returns a tuple with the Networking field value +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadAllOf) GetNetworkingOk() (ret CreateServerPayloadAllOfGetNetworkingRetType, ok bool) { + return getCreateServerPayloadAllOfGetNetworkingAttributeTypeOk(o.Networking) +} + +// SetNetworking sets field value +func (o *CreateServerPayloadAllOf) SetNetworking(v CreateServerPayloadAllOfGetNetworkingRetType) { + setCreateServerPayloadAllOfGetNetworkingAttributeType(&o.Networking, v) +} + +func (o CreateServerPayloadAllOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerPayloadAllOfGetNetworkingAttributeTypeOk(o.Networking); ok { + toSerialize["Networking"] = val + } + return toSerialize, nil +} + +type NullableCreateServerPayloadAllOf struct { + value *CreateServerPayloadAllOf + isSet bool +} + +func (v NullableCreateServerPayloadAllOf) Get() *CreateServerPayloadAllOf { + return v.value +} + +func (v *NullableCreateServerPayloadAllOf) Set(val *CreateServerPayloadAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadAllOf(val *CreateServerPayloadAllOf) *NullableCreateServerPayloadAllOf { + return &NullableCreateServerPayloadAllOf{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_all_of_networking.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_all_of_networking.go new file mode 100644 index 00000000..25336cf8 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_all_of_networking.go @@ -0,0 +1,144 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// CreateServerPayloadAllOfNetworking - struct for CreateServerPayloadAllOfNetworking +type CreateServerPayloadAllOfNetworking struct { + CreateServerNetworking *CreateServerNetworking + CreateServerNetworkingWithNics *CreateServerNetworkingWithNics +} + +// CreateServerNetworkingAsCreateServerPayloadAllOfNetworking is a convenience function that returns CreateServerNetworking wrapped in CreateServerPayloadAllOfNetworking +func CreateServerNetworkingAsCreateServerPayloadAllOfNetworking(v *CreateServerNetworking) CreateServerPayloadAllOfNetworking { + return CreateServerPayloadAllOfNetworking{ + CreateServerNetworking: v, + } +} + +// CreateServerNetworkingWithNicsAsCreateServerPayloadAllOfNetworking is a convenience function that returns CreateServerNetworkingWithNics wrapped in CreateServerPayloadAllOfNetworking +func CreateServerNetworkingWithNicsAsCreateServerPayloadAllOfNetworking(v *CreateServerNetworkingWithNics) CreateServerPayloadAllOfNetworking { + return CreateServerPayloadAllOfNetworking{ + CreateServerNetworkingWithNics: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateServerPayloadAllOfNetworking) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateServerNetworking + dstCreateServerPayloadAllOfNetworking1 := &CreateServerPayloadAllOfNetworking{} + err = json.Unmarshal(data, &dstCreateServerPayloadAllOfNetworking1.CreateServerNetworking) + if err == nil { + jsonCreateServerNetworking, _ := json.Marshal(&dstCreateServerPayloadAllOfNetworking1.CreateServerNetworking) + if string(jsonCreateServerNetworking) != "{}" { // empty struct + dst.CreateServerNetworking = dstCreateServerPayloadAllOfNetworking1.CreateServerNetworking + match++ + } + } + + // try to unmarshal data into CreateServerNetworkingWithNics + dstCreateServerPayloadAllOfNetworking2 := &CreateServerPayloadAllOfNetworking{} + err = json.Unmarshal(data, &dstCreateServerPayloadAllOfNetworking2.CreateServerNetworkingWithNics) + if err == nil { + jsonCreateServerNetworkingWithNics, _ := json.Marshal(&dstCreateServerPayloadAllOfNetworking2.CreateServerNetworkingWithNics) + if string(jsonCreateServerNetworkingWithNics) != "{}" { // empty struct + dst.CreateServerNetworkingWithNics = dstCreateServerPayloadAllOfNetworking2.CreateServerNetworkingWithNics + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateServerNetworking = nil + dst.CreateServerNetworkingWithNics = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateServerPayloadAllOfNetworking)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateServerPayloadAllOfNetworking)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateServerPayloadAllOfNetworking) MarshalJSON() ([]byte, error) { + if src.CreateServerNetworking != nil { + return json.Marshal(&src.CreateServerNetworking) + } + + if src.CreateServerNetworkingWithNics != nil { + return json.Marshal(&src.CreateServerNetworkingWithNics) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateServerPayloadAllOfNetworking) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateServerNetworking != nil { + return obj.CreateServerNetworking + } + + if obj.CreateServerNetworkingWithNics != nil { + return obj.CreateServerNetworkingWithNics + } + + // all schemas are nil + return nil +} + +type NullableCreateServerPayloadAllOfNetworking struct { + value *CreateServerPayloadAllOfNetworking + isSet bool +} + +func (v NullableCreateServerPayloadAllOfNetworking) Get() *CreateServerPayloadAllOfNetworking { + return v.value +} + +func (v *NullableCreateServerPayloadAllOfNetworking) Set(val *CreateServerPayloadAllOfNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadAllOfNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadAllOfNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadAllOfNetworking(val *CreateServerPayloadAllOfNetworking) *NullableCreateServerPayloadAllOfNetworking { + return &NullableCreateServerPayloadAllOfNetworking{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadAllOfNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadAllOfNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_boot_volume.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_boot_volume.go new file mode 100644 index 00000000..1d63d1bf --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_boot_volume.go @@ -0,0 +1,321 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the CreateServerPayloadBootVolume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateServerPayloadBootVolume{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type CreateServerPayloadBootVolumegetDeleteOnTerminationAttributeType = *bool +type CreateServerPayloadBootVolumegetDeleteOnTerminationArgType = bool +type CreateServerPayloadBootVolumegetDeleteOnTerminationRetType = bool + +func getCreateServerPayloadBootVolumegetDeleteOnTerminationAttributeTypeOk(arg CreateServerPayloadBootVolumegetDeleteOnTerminationAttributeType) (ret CreateServerPayloadBootVolumegetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadBootVolumegetDeleteOnTerminationAttributeType(arg *CreateServerPayloadBootVolumegetDeleteOnTerminationAttributeType, val CreateServerPayloadBootVolumegetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateServerPayloadBootVolumeGetIdAttributeType = *string + +func getCreateServerPayloadBootVolumeGetIdAttributeTypeOk(arg CreateServerPayloadBootVolumeGetIdAttributeType) (ret CreateServerPayloadBootVolumeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadBootVolumeGetIdAttributeType(arg *CreateServerPayloadBootVolumeGetIdAttributeType, val CreateServerPayloadBootVolumeGetIdRetType) { + *arg = &val +} + +type CreateServerPayloadBootVolumeGetIdArgType = string +type CreateServerPayloadBootVolumeGetIdRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type CreateServerPayloadBootVolumeGetPerformanceClassAttributeType = *string + +func getCreateServerPayloadBootVolumeGetPerformanceClassAttributeTypeOk(arg CreateServerPayloadBootVolumeGetPerformanceClassAttributeType) (ret CreateServerPayloadBootVolumeGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadBootVolumeGetPerformanceClassAttributeType(arg *CreateServerPayloadBootVolumeGetPerformanceClassAttributeType, val CreateServerPayloadBootVolumeGetPerformanceClassRetType) { + *arg = &val +} + +type CreateServerPayloadBootVolumeGetPerformanceClassArgType = string +type CreateServerPayloadBootVolumeGetPerformanceClassRetType = string + +/* + types and functions for size +*/ + +// isLong +type CreateServerPayloadBootVolumeGetSizeAttributeType = *int64 +type CreateServerPayloadBootVolumeGetSizeArgType = int64 +type CreateServerPayloadBootVolumeGetSizeRetType = int64 + +func getCreateServerPayloadBootVolumeGetSizeAttributeTypeOk(arg CreateServerPayloadBootVolumeGetSizeAttributeType) (ret CreateServerPayloadBootVolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadBootVolumeGetSizeAttributeType(arg *CreateServerPayloadBootVolumeGetSizeAttributeType, val CreateServerPayloadBootVolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type CreateServerPayloadBootVolumeGetSourceAttributeType = *BootVolumeSource +type CreateServerPayloadBootVolumeGetSourceArgType = BootVolumeSource +type CreateServerPayloadBootVolumeGetSourceRetType = BootVolumeSource + +func getCreateServerPayloadBootVolumeGetSourceAttributeTypeOk(arg CreateServerPayloadBootVolumeGetSourceAttributeType) (ret CreateServerPayloadBootVolumeGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateServerPayloadBootVolumeGetSourceAttributeType(arg *CreateServerPayloadBootVolumeGetSourceAttributeType, val CreateServerPayloadBootVolumeGetSourceRetType) { + *arg = &val +} + +// CreateServerPayloadBootVolume struct for CreateServerPayloadBootVolume +type CreateServerPayloadBootVolume struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination CreateServerPayloadBootVolumegetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateServerPayloadBootVolumeGetIdAttributeType `json:"id,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass CreateServerPayloadBootVolumeGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Size in Gigabyte. + Size CreateServerPayloadBootVolumeGetSizeAttributeType `json:"size,omitempty"` + Source CreateServerPayloadBootVolumeGetSourceAttributeType `json:"source,omitempty"` +} + +// NewCreateServerPayloadBootVolume instantiates a new CreateServerPayloadBootVolume object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateServerPayloadBootVolume() *CreateServerPayloadBootVolume { + this := CreateServerPayloadBootVolume{} + return &this +} + +// NewCreateServerPayloadBootVolumeWithDefaults instantiates a new CreateServerPayloadBootVolume object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateServerPayloadBootVolumeWithDefaults() *CreateServerPayloadBootVolume { + this := CreateServerPayloadBootVolume{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetDeleteOnTermination() (res CreateServerPayloadBootVolumegetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetDeleteOnTerminationOk() (ret CreateServerPayloadBootVolumegetDeleteOnTerminationRetType, ok bool) { + return getCreateServerPayloadBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *CreateServerPayloadBootVolume) SetDeleteOnTermination(v CreateServerPayloadBootVolumegetDeleteOnTerminationRetType) { + setCreateServerPayloadBootVolumegetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetId() (res CreateServerPayloadBootVolumeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetIdOk() (ret CreateServerPayloadBootVolumeGetIdRetType, ok bool) { + return getCreateServerPayloadBootVolumeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateServerPayloadBootVolume) SetId(v CreateServerPayloadBootVolumeGetIdRetType) { + setCreateServerPayloadBootVolumeGetIdAttributeType(&o.Id, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetPerformanceClass() (res CreateServerPayloadBootVolumeGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetPerformanceClassOk() (ret CreateServerPayloadBootVolumeGetPerformanceClassRetType, ok bool) { + return getCreateServerPayloadBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *CreateServerPayloadBootVolume) SetPerformanceClass(v CreateServerPayloadBootVolumeGetPerformanceClassRetType) { + setCreateServerPayloadBootVolumeGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetSize() (res CreateServerPayloadBootVolumeGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetSizeOk() (ret CreateServerPayloadBootVolumeGetSizeRetType, ok bool) { + return getCreateServerPayloadBootVolumeGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateServerPayloadBootVolume) SetSize(v CreateServerPayloadBootVolumeGetSizeRetType) { + setCreateServerPayloadBootVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *CreateServerPayloadBootVolume) GetSource() (res CreateServerPayloadBootVolumeGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateServerPayloadBootVolume) GetSourceOk() (ret CreateServerPayloadBootVolumeGetSourceRetType, ok bool) { + return getCreateServerPayloadBootVolumeGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *CreateServerPayloadBootVolume) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given BootVolumeSource and assigns it to the Source field. +func (o *CreateServerPayloadBootVolume) SetSource(v CreateServerPayloadBootVolumeGetSourceRetType) { + setCreateServerPayloadBootVolumeGetSourceAttributeType(&o.Source, v) +} + +func (o CreateServerPayloadBootVolume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateServerPayloadBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getCreateServerPayloadBootVolumeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateServerPayloadBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getCreateServerPayloadBootVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getCreateServerPayloadBootVolumeGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableCreateServerPayloadBootVolume struct { + value *CreateServerPayloadBootVolume + isSet bool +} + +func (v NullableCreateServerPayloadBootVolume) Get() *CreateServerPayloadBootVolume { + return v.value +} + +func (v *NullableCreateServerPayloadBootVolume) Set(val *CreateServerPayloadBootVolume) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadBootVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadBootVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadBootVolume(val *CreateServerPayloadBootVolume) *NullableCreateServerPayloadBootVolume { + return &NullableCreateServerPayloadBootVolume{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadBootVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadBootVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_networking.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_networking.go new file mode 100644 index 00000000..ca75af9f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_server_payload_networking.go @@ -0,0 +1,144 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// CreateServerPayloadNetworking - The initial networking setup for the server creation. A network, a nic or nothing can be given. +type CreateServerPayloadNetworking struct { + CreateServerNetworking *CreateServerNetworking + CreateServerNetworkingWithNics *CreateServerNetworkingWithNics +} + +// CreateServerNetworkingAsCreateServerPayloadNetworking is a convenience function that returns CreateServerNetworking wrapped in CreateServerPayloadNetworking +func CreateServerNetworkingAsCreateServerPayloadNetworking(v *CreateServerNetworking) CreateServerPayloadNetworking { + return CreateServerPayloadNetworking{ + CreateServerNetworking: v, + } +} + +// CreateServerNetworkingWithNicsAsCreateServerPayloadNetworking is a convenience function that returns CreateServerNetworkingWithNics wrapped in CreateServerPayloadNetworking +func CreateServerNetworkingWithNicsAsCreateServerPayloadNetworking(v *CreateServerNetworkingWithNics) CreateServerPayloadNetworking { + return CreateServerPayloadNetworking{ + CreateServerNetworkingWithNics: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *CreateServerPayloadNetworking) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateServerNetworking + dstCreateServerPayloadNetworking1 := &CreateServerPayloadNetworking{} + err = json.Unmarshal(data, &dstCreateServerPayloadNetworking1.CreateServerNetworking) + if err == nil { + jsonCreateServerNetworking, _ := json.Marshal(&dstCreateServerPayloadNetworking1.CreateServerNetworking) + if string(jsonCreateServerNetworking) != "{}" { // empty struct + dst.CreateServerNetworking = dstCreateServerPayloadNetworking1.CreateServerNetworking + match++ + } + } + + // try to unmarshal data into CreateServerNetworkingWithNics + dstCreateServerPayloadNetworking2 := &CreateServerPayloadNetworking{} + err = json.Unmarshal(data, &dstCreateServerPayloadNetworking2.CreateServerNetworkingWithNics) + if err == nil { + jsonCreateServerNetworkingWithNics, _ := json.Marshal(&dstCreateServerPayloadNetworking2.CreateServerNetworkingWithNics) + if string(jsonCreateServerNetworkingWithNics) != "{}" { // empty struct + dst.CreateServerNetworkingWithNics = dstCreateServerPayloadNetworking2.CreateServerNetworkingWithNics + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateServerNetworking = nil + dst.CreateServerNetworkingWithNics = nil + + return fmt.Errorf("data matches more than one schema in oneOf(CreateServerPayloadNetworking)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(CreateServerPayloadNetworking)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src CreateServerPayloadNetworking) MarshalJSON() ([]byte, error) { + if src.CreateServerNetworking != nil { + return json.Marshal(&src.CreateServerNetworking) + } + + if src.CreateServerNetworkingWithNics != nil { + return json.Marshal(&src.CreateServerNetworkingWithNics) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *CreateServerPayloadNetworking) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateServerNetworking != nil { + return obj.CreateServerNetworking + } + + if obj.CreateServerNetworkingWithNics != nil { + return obj.CreateServerNetworkingWithNics + } + + // all schemas are nil + return nil +} + +type NullableCreateServerPayloadNetworking struct { + value *CreateServerPayloadNetworking + isSet bool +} + +func (v NullableCreateServerPayloadNetworking) Get() *CreateServerPayloadNetworking { + return v.value +} + +func (v *NullableCreateServerPayloadNetworking) Set(val *CreateServerPayloadNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableCreateServerPayloadNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateServerPayloadNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateServerPayloadNetworking(val *CreateServerPayloadNetworking) *NullableCreateServerPayloadNetworking { + return &NullableCreateServerPayloadNetworking{value: val, isSet: true} +} + +func (v NullableCreateServerPayloadNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateServerPayloadNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_snapshot_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_snapshot_payload.go new file mode 100644 index 00000000..3293855d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_snapshot_payload.go @@ -0,0 +1,467 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateSnapshotPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSnapshotPayload{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateSnapshotPayloadGetCreatedAtAttributeType = *time.Time +type CreateSnapshotPayloadGetCreatedAtArgType = time.Time +type CreateSnapshotPayloadGetCreatedAtRetType = time.Time + +func getCreateSnapshotPayloadGetCreatedAtAttributeTypeOk(arg CreateSnapshotPayloadGetCreatedAtAttributeType) (ret CreateSnapshotPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetCreatedAtAttributeType(arg *CreateSnapshotPayloadGetCreatedAtAttributeType, val CreateSnapshotPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateSnapshotPayloadGetIdAttributeType = *string + +func getCreateSnapshotPayloadGetIdAttributeTypeOk(arg CreateSnapshotPayloadGetIdAttributeType) (ret CreateSnapshotPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetIdAttributeType(arg *CreateSnapshotPayloadGetIdAttributeType, val CreateSnapshotPayloadGetIdRetType) { + *arg = &val +} + +type CreateSnapshotPayloadGetIdArgType = string +type CreateSnapshotPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateSnapshotPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateSnapshotPayloadGetLabelsArgType = map[string]interface{} +type CreateSnapshotPayloadGetLabelsRetType = map[string]interface{} + +func getCreateSnapshotPayloadGetLabelsAttributeTypeOk(arg CreateSnapshotPayloadGetLabelsAttributeType) (ret CreateSnapshotPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetLabelsAttributeType(arg *CreateSnapshotPayloadGetLabelsAttributeType, val CreateSnapshotPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateSnapshotPayloadGetNameAttributeType = *string + +func getCreateSnapshotPayloadGetNameAttributeTypeOk(arg CreateSnapshotPayloadGetNameAttributeType) (ret CreateSnapshotPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetNameAttributeType(arg *CreateSnapshotPayloadGetNameAttributeType, val CreateSnapshotPayloadGetNameRetType) { + *arg = &val +} + +type CreateSnapshotPayloadGetNameArgType = string +type CreateSnapshotPayloadGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type CreateSnapshotPayloadGetSizeAttributeType = *int64 +type CreateSnapshotPayloadGetSizeArgType = int64 +type CreateSnapshotPayloadGetSizeRetType = int64 + +func getCreateSnapshotPayloadGetSizeAttributeTypeOk(arg CreateSnapshotPayloadGetSizeAttributeType) (ret CreateSnapshotPayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetSizeAttributeType(arg *CreateSnapshotPayloadGetSizeAttributeType, val CreateSnapshotPayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateSnapshotPayloadGetStatusAttributeType = *string + +func getCreateSnapshotPayloadGetStatusAttributeTypeOk(arg CreateSnapshotPayloadGetStatusAttributeType) (ret CreateSnapshotPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetStatusAttributeType(arg *CreateSnapshotPayloadGetStatusAttributeType, val CreateSnapshotPayloadGetStatusRetType) { + *arg = &val +} + +type CreateSnapshotPayloadGetStatusArgType = string +type CreateSnapshotPayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateSnapshotPayloadGetUpdatedAtAttributeType = *time.Time +type CreateSnapshotPayloadGetUpdatedAtArgType = time.Time +type CreateSnapshotPayloadGetUpdatedAtRetType = time.Time + +func getCreateSnapshotPayloadGetUpdatedAtAttributeTypeOk(arg CreateSnapshotPayloadGetUpdatedAtAttributeType) (ret CreateSnapshotPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetUpdatedAtAttributeType(arg *CreateSnapshotPayloadGetUpdatedAtAttributeType, val CreateSnapshotPayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type CreateSnapshotPayloadGetVolumeIdAttributeType = *string + +func getCreateSnapshotPayloadGetVolumeIdAttributeTypeOk(arg CreateSnapshotPayloadGetVolumeIdAttributeType) (ret CreateSnapshotPayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateSnapshotPayloadGetVolumeIdAttributeType(arg *CreateSnapshotPayloadGetVolumeIdAttributeType, val CreateSnapshotPayloadGetVolumeIdRetType) { + *arg = &val +} + +type CreateSnapshotPayloadGetVolumeIdArgType = string +type CreateSnapshotPayloadGetVolumeIdRetType = string + +// CreateSnapshotPayload Object that represents a snapshot. +type CreateSnapshotPayload struct { + // Date-time when resource was created. + CreatedAt CreateSnapshotPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateSnapshotPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateSnapshotPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name CreateSnapshotPayloadGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size CreateSnapshotPayloadGetSizeAttributeType `json:"size,omitempty"` + // The status of a snapshot object. Possible values: `AVAILABLE`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + Status CreateSnapshotPayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateSnapshotPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + VolumeId CreateSnapshotPayloadGetVolumeIdAttributeType `json:"volumeId" required:"true"` +} + +type _CreateSnapshotPayload CreateSnapshotPayload + +// NewCreateSnapshotPayload instantiates a new CreateSnapshotPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateSnapshotPayload(volumeId CreateSnapshotPayloadGetVolumeIdArgType) *CreateSnapshotPayload { + this := CreateSnapshotPayload{} + setCreateSnapshotPayloadGetVolumeIdAttributeType(&this.VolumeId, volumeId) + return &this +} + +// NewCreateSnapshotPayloadWithDefaults instantiates a new CreateSnapshotPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateSnapshotPayloadWithDefaults() *CreateSnapshotPayload { + this := CreateSnapshotPayload{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetCreatedAt() (res CreateSnapshotPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetCreatedAtOk() (ret CreateSnapshotPayloadGetCreatedAtRetType, ok bool) { + return getCreateSnapshotPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateSnapshotPayload) SetCreatedAt(v CreateSnapshotPayloadGetCreatedAtRetType) { + setCreateSnapshotPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetId() (res CreateSnapshotPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetIdOk() (ret CreateSnapshotPayloadGetIdRetType, ok bool) { + return getCreateSnapshotPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateSnapshotPayload) SetId(v CreateSnapshotPayloadGetIdRetType) { + setCreateSnapshotPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetLabels() (res CreateSnapshotPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetLabelsOk() (ret CreateSnapshotPayloadGetLabelsRetType, ok bool) { + return getCreateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateSnapshotPayload) SetLabels(v CreateSnapshotPayloadGetLabelsRetType) { + setCreateSnapshotPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetName() (res CreateSnapshotPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetNameOk() (ret CreateSnapshotPayloadGetNameRetType, ok bool) { + return getCreateSnapshotPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateSnapshotPayload) SetName(v CreateSnapshotPayloadGetNameRetType) { + setCreateSnapshotPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetSize() (res CreateSnapshotPayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetSizeOk() (ret CreateSnapshotPayloadGetSizeRetType, ok bool) { + return getCreateSnapshotPayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateSnapshotPayload) SetSize(v CreateSnapshotPayloadGetSizeRetType) { + setCreateSnapshotPayloadGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetStatus() (res CreateSnapshotPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetStatusOk() (ret CreateSnapshotPayloadGetStatusRetType, ok bool) { + return getCreateSnapshotPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateSnapshotPayload) SetStatus(v CreateSnapshotPayloadGetStatusRetType) { + setCreateSnapshotPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateSnapshotPayload) GetUpdatedAt() (res CreateSnapshotPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetUpdatedAtOk() (ret CreateSnapshotPayloadGetUpdatedAtRetType, ok bool) { + return getCreateSnapshotPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateSnapshotPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateSnapshotPayload) SetUpdatedAt(v CreateSnapshotPayloadGetUpdatedAtRetType) { + setCreateSnapshotPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value +func (o *CreateSnapshotPayload) GetVolumeId() (ret CreateSnapshotPayloadGetVolumeIdRetType) { + ret, _ = o.GetVolumeIdOk() + return ret +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value +// and a boolean to check if the value has been set. +func (o *CreateSnapshotPayload) GetVolumeIdOk() (ret CreateSnapshotPayloadGetVolumeIdRetType, ok bool) { + return getCreateSnapshotPayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// SetVolumeId sets field value +func (o *CreateSnapshotPayload) SetVolumeId(v CreateSnapshotPayloadGetVolumeIdRetType) { + setCreateSnapshotPayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o CreateSnapshotPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateSnapshotPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateSnapshotPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateSnapshotPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateSnapshotPayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getCreateSnapshotPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateSnapshotPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getCreateSnapshotPayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableCreateSnapshotPayload struct { + value *CreateSnapshotPayload + isSet bool +} + +func (v NullableCreateSnapshotPayload) Get() *CreateSnapshotPayload { + return v.value +} + +func (v *NullableCreateSnapshotPayload) Set(val *CreateSnapshotPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateSnapshotPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateSnapshotPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateSnapshotPayload(val *CreateSnapshotPayload) *NullableCreateSnapshotPayload { + return &NullableCreateSnapshotPayload{value: val, isSet: true} +} + +func (v NullableCreateSnapshotPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateSnapshotPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_volume_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_volume_payload.go new file mode 100644 index 00000000..48a046db --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_create_volume_payload.go @@ -0,0 +1,851 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the CreateVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateVolumePayload{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type CreateVolumePayloadGetAvailabilityZoneAttributeType = *string + +func getCreateVolumePayloadGetAvailabilityZoneAttributeTypeOk(arg CreateVolumePayloadGetAvailabilityZoneAttributeType) (ret CreateVolumePayloadGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetAvailabilityZoneAttributeType(arg *CreateVolumePayloadGetAvailabilityZoneAttributeType, val CreateVolumePayloadGetAvailabilityZoneRetType) { + *arg = &val +} + +type CreateVolumePayloadGetAvailabilityZoneArgType = string +type CreateVolumePayloadGetAvailabilityZoneRetType = string + +/* + types and functions for bootable +*/ + +// isBoolean +type CreateVolumePayloadgetBootableAttributeType = *bool +type CreateVolumePayloadgetBootableArgType = bool +type CreateVolumePayloadgetBootableRetType = bool + +func getCreateVolumePayloadgetBootableAttributeTypeOk(arg CreateVolumePayloadgetBootableAttributeType) (ret CreateVolumePayloadgetBootableRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadgetBootableAttributeType(arg *CreateVolumePayloadgetBootableAttributeType, val CreateVolumePayloadgetBootableRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type CreateVolumePayloadGetCreatedAtAttributeType = *time.Time +type CreateVolumePayloadGetCreatedAtArgType = time.Time +type CreateVolumePayloadGetCreatedAtRetType = time.Time + +func getCreateVolumePayloadGetCreatedAtAttributeTypeOk(arg CreateVolumePayloadGetCreatedAtAttributeType) (ret CreateVolumePayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetCreatedAtAttributeType(arg *CreateVolumePayloadGetCreatedAtAttributeType, val CreateVolumePayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateVolumePayloadGetDescriptionAttributeType = *string + +func getCreateVolumePayloadGetDescriptionAttributeTypeOk(arg CreateVolumePayloadGetDescriptionAttributeType) (ret CreateVolumePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetDescriptionAttributeType(arg *CreateVolumePayloadGetDescriptionAttributeType, val CreateVolumePayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateVolumePayloadGetDescriptionArgType = string +type CreateVolumePayloadGetDescriptionRetType = string + +/* + types and functions for encrypted +*/ + +// isBoolean +type CreateVolumePayloadgetEncryptedAttributeType = *bool +type CreateVolumePayloadgetEncryptedArgType = bool +type CreateVolumePayloadgetEncryptedRetType = bool + +func getCreateVolumePayloadgetEncryptedAttributeTypeOk(arg CreateVolumePayloadgetEncryptedAttributeType) (ret CreateVolumePayloadgetEncryptedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadgetEncryptedAttributeType(arg *CreateVolumePayloadgetEncryptedAttributeType, val CreateVolumePayloadgetEncryptedRetType) { + *arg = &val +} + +/* + types and functions for encryptionParameters +*/ + +// isModel +type CreateVolumePayloadGetEncryptionParametersAttributeType = *VolumeEncryptionParameter +type CreateVolumePayloadGetEncryptionParametersArgType = VolumeEncryptionParameter +type CreateVolumePayloadGetEncryptionParametersRetType = VolumeEncryptionParameter + +func getCreateVolumePayloadGetEncryptionParametersAttributeTypeOk(arg CreateVolumePayloadGetEncryptionParametersAttributeType) (ret CreateVolumePayloadGetEncryptionParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetEncryptionParametersAttributeType(arg *CreateVolumePayloadGetEncryptionParametersAttributeType, val CreateVolumePayloadGetEncryptionParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type CreateVolumePayloadGetIdAttributeType = *string + +func getCreateVolumePayloadGetIdAttributeTypeOk(arg CreateVolumePayloadGetIdAttributeType) (ret CreateVolumePayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetIdAttributeType(arg *CreateVolumePayloadGetIdAttributeType, val CreateVolumePayloadGetIdRetType) { + *arg = &val +} + +type CreateVolumePayloadGetIdArgType = string +type CreateVolumePayloadGetIdRetType = string + +/* + types and functions for imageConfig +*/ + +// isModel +type CreateVolumePayloadGetImageConfigAttributeType = *ImageConfig +type CreateVolumePayloadGetImageConfigArgType = ImageConfig +type CreateVolumePayloadGetImageConfigRetType = ImageConfig + +func getCreateVolumePayloadGetImageConfigAttributeTypeOk(arg CreateVolumePayloadGetImageConfigAttributeType) (ret CreateVolumePayloadGetImageConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetImageConfigAttributeType(arg *CreateVolumePayloadGetImageConfigAttributeType, val CreateVolumePayloadGetImageConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type CreateVolumePayloadGetLabelsAttributeType = *map[string]interface{} +type CreateVolumePayloadGetLabelsArgType = map[string]interface{} +type CreateVolumePayloadGetLabelsRetType = map[string]interface{} + +func getCreateVolumePayloadGetLabelsAttributeTypeOk(arg CreateVolumePayloadGetLabelsAttributeType) (ret CreateVolumePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetLabelsAttributeType(arg *CreateVolumePayloadGetLabelsAttributeType, val CreateVolumePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateVolumePayloadGetNameAttributeType = *string + +func getCreateVolumePayloadGetNameAttributeTypeOk(arg CreateVolumePayloadGetNameAttributeType) (ret CreateVolumePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetNameAttributeType(arg *CreateVolumePayloadGetNameAttributeType, val CreateVolumePayloadGetNameRetType) { + *arg = &val +} + +type CreateVolumePayloadGetNameArgType = string +type CreateVolumePayloadGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type CreateVolumePayloadGetPerformanceClassAttributeType = *string + +func getCreateVolumePayloadGetPerformanceClassAttributeTypeOk(arg CreateVolumePayloadGetPerformanceClassAttributeType) (ret CreateVolumePayloadGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetPerformanceClassAttributeType(arg *CreateVolumePayloadGetPerformanceClassAttributeType, val CreateVolumePayloadGetPerformanceClassRetType) { + *arg = &val +} + +type CreateVolumePayloadGetPerformanceClassArgType = string +type CreateVolumePayloadGetPerformanceClassRetType = string + +/* + types and functions for serverId +*/ + +// isNotNullableString +type CreateVolumePayloadGetServerIdAttributeType = *string + +func getCreateVolumePayloadGetServerIdAttributeTypeOk(arg CreateVolumePayloadGetServerIdAttributeType) (ret CreateVolumePayloadGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetServerIdAttributeType(arg *CreateVolumePayloadGetServerIdAttributeType, val CreateVolumePayloadGetServerIdRetType) { + *arg = &val +} + +type CreateVolumePayloadGetServerIdArgType = string +type CreateVolumePayloadGetServerIdRetType = string + +/* + types and functions for size +*/ + +// isLong +type CreateVolumePayloadGetSizeAttributeType = *int64 +type CreateVolumePayloadGetSizeArgType = int64 +type CreateVolumePayloadGetSizeRetType = int64 + +func getCreateVolumePayloadGetSizeAttributeTypeOk(arg CreateVolumePayloadGetSizeAttributeType) (ret CreateVolumePayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetSizeAttributeType(arg *CreateVolumePayloadGetSizeAttributeType, val CreateVolumePayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type CreateVolumePayloadGetSourceAttributeType = *VolumeSource +type CreateVolumePayloadGetSourceArgType = VolumeSource +type CreateVolumePayloadGetSourceRetType = VolumeSource + +func getCreateVolumePayloadGetSourceAttributeTypeOk(arg CreateVolumePayloadGetSourceAttributeType) (ret CreateVolumePayloadGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetSourceAttributeType(arg *CreateVolumePayloadGetSourceAttributeType, val CreateVolumePayloadGetSourceRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type CreateVolumePayloadGetStatusAttributeType = *string + +func getCreateVolumePayloadGetStatusAttributeTypeOk(arg CreateVolumePayloadGetStatusAttributeType) (ret CreateVolumePayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetStatusAttributeType(arg *CreateVolumePayloadGetStatusAttributeType, val CreateVolumePayloadGetStatusRetType) { + *arg = &val +} + +type CreateVolumePayloadGetStatusArgType = string +type CreateVolumePayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type CreateVolumePayloadGetUpdatedAtAttributeType = *time.Time +type CreateVolumePayloadGetUpdatedAtArgType = time.Time +type CreateVolumePayloadGetUpdatedAtRetType = time.Time + +func getCreateVolumePayloadGetUpdatedAtAttributeTypeOk(arg CreateVolumePayloadGetUpdatedAtAttributeType) (ret CreateVolumePayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateVolumePayloadGetUpdatedAtAttributeType(arg *CreateVolumePayloadGetUpdatedAtAttributeType, val CreateVolumePayloadGetUpdatedAtRetType) { + *arg = &val +} + +// CreateVolumePayload Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. +type CreateVolumePayload struct { + // Object that represents an availability zone. + // REQUIRED + AvailabilityZone CreateVolumePayloadGetAvailabilityZoneAttributeType `json:"availabilityZone" required:"true"` + // Indicates if a volume is bootable. + Bootable CreateVolumePayloadgetBootableAttributeType `json:"bootable,omitempty"` + // Date-time when resource was created. + CreatedAt CreateVolumePayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description CreateVolumePayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Indicates if a volume is encrypted. + Encrypted CreateVolumePayloadgetEncryptedAttributeType `json:"encrypted,omitempty"` + EncryptionParameters CreateVolumePayloadGetEncryptionParametersAttributeType `json:"encryptionParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id CreateVolumePayloadGetIdAttributeType `json:"id,omitempty"` + ImageConfig CreateVolumePayloadGetImageConfigAttributeType `json:"imageConfig,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels CreateVolumePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name CreateVolumePayloadGetNameAttributeType `json:"name,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass CreateVolumePayloadGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Universally Unique Identifier (UUID). + ServerId CreateVolumePayloadGetServerIdAttributeType `json:"serverId,omitempty"` + // Size in Gigabyte. + Size CreateVolumePayloadGetSizeAttributeType `json:"size,omitempty"` + Source CreateVolumePayloadGetSourceAttributeType `json:"source,omitempty"` + // The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `DETACHING`, `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, `MAINTENANCE`, `RESERVED`, `RESIZING`, `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + Status CreateVolumePayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt CreateVolumePayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _CreateVolumePayload CreateVolumePayload + +// NewCreateVolumePayload instantiates a new CreateVolumePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateVolumePayload(availabilityZone CreateVolumePayloadGetAvailabilityZoneArgType) *CreateVolumePayload { + this := CreateVolumePayload{} + setCreateVolumePayloadGetAvailabilityZoneAttributeType(&this.AvailabilityZone, availabilityZone) + return &this +} + +// NewCreateVolumePayloadWithDefaults instantiates a new CreateVolumePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateVolumePayloadWithDefaults() *CreateVolumePayload { + this := CreateVolumePayload{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value +func (o *CreateVolumePayload) GetAvailabilityZone() (ret CreateVolumePayloadGetAvailabilityZoneRetType) { + ret, _ = o.GetAvailabilityZoneOk() + return ret +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetAvailabilityZoneOk() (ret CreateVolumePayloadGetAvailabilityZoneRetType, ok bool) { + return getCreateVolumePayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// SetAvailabilityZone sets field value +func (o *CreateVolumePayload) SetAvailabilityZone(v CreateVolumePayloadGetAvailabilityZoneRetType) { + setCreateVolumePayloadGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetBootable() (res CreateVolumePayloadgetBootableRetType) { + res, _ = o.GetBootableOk() + return +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetBootableOk() (ret CreateVolumePayloadgetBootableRetType, ok bool) { + return getCreateVolumePayloadgetBootableAttributeTypeOk(o.Bootable) +} + +// HasBootable returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasBootable() bool { + _, ok := o.GetBootableOk() + return ok +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *CreateVolumePayload) SetBootable(v CreateVolumePayloadgetBootableRetType) { + setCreateVolumePayloadgetBootableAttributeType(&o.Bootable, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetCreatedAt() (res CreateVolumePayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetCreatedAtOk() (ret CreateVolumePayloadGetCreatedAtRetType, ok bool) { + return getCreateVolumePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *CreateVolumePayload) SetCreatedAt(v CreateVolumePayloadGetCreatedAtRetType) { + setCreateVolumePayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetDescription() (res CreateVolumePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetDescriptionOk() (ret CreateVolumePayloadGetDescriptionRetType, ok bool) { + return getCreateVolumePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateVolumePayload) SetDescription(v CreateVolumePayloadGetDescriptionRetType) { + setCreateVolumePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetEncrypted returns the Encrypted field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetEncrypted() (res CreateVolumePayloadgetEncryptedRetType) { + res, _ = o.GetEncryptedOk() + return +} + +// GetEncryptedOk returns a tuple with the Encrypted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetEncryptedOk() (ret CreateVolumePayloadgetEncryptedRetType, ok bool) { + return getCreateVolumePayloadgetEncryptedAttributeTypeOk(o.Encrypted) +} + +// HasEncrypted returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasEncrypted() bool { + _, ok := o.GetEncryptedOk() + return ok +} + +// SetEncrypted gets a reference to the given bool and assigns it to the Encrypted field. +func (o *CreateVolumePayload) SetEncrypted(v CreateVolumePayloadgetEncryptedRetType) { + setCreateVolumePayloadgetEncryptedAttributeType(&o.Encrypted, v) +} + +// GetEncryptionParameters returns the EncryptionParameters field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetEncryptionParameters() (res CreateVolumePayloadGetEncryptionParametersRetType) { + res, _ = o.GetEncryptionParametersOk() + return +} + +// GetEncryptionParametersOk returns a tuple with the EncryptionParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetEncryptionParametersOk() (ret CreateVolumePayloadGetEncryptionParametersRetType, ok bool) { + return getCreateVolumePayloadGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters) +} + +// HasEncryptionParameters returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasEncryptionParameters() bool { + _, ok := o.GetEncryptionParametersOk() + return ok +} + +// SetEncryptionParameters gets a reference to the given VolumeEncryptionParameter and assigns it to the EncryptionParameters field. +func (o *CreateVolumePayload) SetEncryptionParameters(v CreateVolumePayloadGetEncryptionParametersRetType) { + setCreateVolumePayloadGetEncryptionParametersAttributeType(&o.EncryptionParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetId() (res CreateVolumePayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetIdOk() (ret CreateVolumePayloadGetIdRetType, ok bool) { + return getCreateVolumePayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *CreateVolumePayload) SetId(v CreateVolumePayloadGetIdRetType) { + setCreateVolumePayloadGetIdAttributeType(&o.Id, v) +} + +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetImageConfig() (res CreateVolumePayloadGetImageConfigRetType) { + res, _ = o.GetImageConfigOk() + return +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetImageConfigOk() (ret CreateVolumePayloadGetImageConfigRetType, ok bool) { + return getCreateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig) +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasImageConfig() bool { + _, ok := o.GetImageConfigOk() + return ok +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *CreateVolumePayload) SetImageConfig(v CreateVolumePayloadGetImageConfigRetType) { + setCreateVolumePayloadGetImageConfigAttributeType(&o.ImageConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetLabels() (res CreateVolumePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetLabelsOk() (ret CreateVolumePayloadGetLabelsRetType, ok bool) { + return getCreateVolumePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateVolumePayload) SetLabels(v CreateVolumePayloadGetLabelsRetType) { + setCreateVolumePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetName() (res CreateVolumePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetNameOk() (ret CreateVolumePayloadGetNameRetType, ok bool) { + return getCreateVolumePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateVolumePayload) SetName(v CreateVolumePayloadGetNameRetType) { + setCreateVolumePayloadGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetPerformanceClass() (res CreateVolumePayloadGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetPerformanceClassOk() (ret CreateVolumePayloadGetPerformanceClassRetType, ok bool) { + return getCreateVolumePayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *CreateVolumePayload) SetPerformanceClass(v CreateVolumePayloadGetPerformanceClassRetType) { + setCreateVolumePayloadGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetServerId() (res CreateVolumePayloadGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetServerIdOk() (ret CreateVolumePayloadGetServerIdRetType, ok bool) { + return getCreateVolumePayloadGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *CreateVolumePayload) SetServerId(v CreateVolumePayloadGetServerIdRetType) { + setCreateVolumePayloadGetServerIdAttributeType(&o.ServerId, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetSize() (res CreateVolumePayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetSizeOk() (ret CreateVolumePayloadGetSizeRetType, ok bool) { + return getCreateVolumePayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateVolumePayload) SetSize(v CreateVolumePayloadGetSizeRetType) { + setCreateVolumePayloadGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetSource() (res CreateVolumePayloadGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetSourceOk() (ret CreateVolumePayloadGetSourceRetType, ok bool) { + return getCreateVolumePayloadGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given VolumeSource and assigns it to the Source field. +func (o *CreateVolumePayload) SetSource(v CreateVolumePayloadGetSourceRetType) { + setCreateVolumePayloadGetSourceAttributeType(&o.Source, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetStatus() (res CreateVolumePayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetStatusOk() (ret CreateVolumePayloadGetStatusRetType, ok bool) { + return getCreateVolumePayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *CreateVolumePayload) SetStatus(v CreateVolumePayloadGetStatusRetType) { + setCreateVolumePayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *CreateVolumePayload) GetUpdatedAt() (res CreateVolumePayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateVolumePayload) GetUpdatedAtOk() (ret CreateVolumePayloadGetUpdatedAtRetType, ok bool) { + return getCreateVolumePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *CreateVolumePayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *CreateVolumePayload) SetUpdatedAt(v CreateVolumePayloadGetUpdatedAtRetType) { + setCreateVolumePayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o CreateVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateVolumePayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getCreateVolumePayloadgetBootableAttributeTypeOk(o.Bootable); ok { + toSerialize["Bootable"] = val + } + if val, ok := getCreateVolumePayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getCreateVolumePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getCreateVolumePayloadgetEncryptedAttributeTypeOk(o.Encrypted); ok { + toSerialize["Encrypted"] = val + } + if val, ok := getCreateVolumePayloadGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters); ok { + toSerialize["EncryptionParameters"] = val + } + if val, ok := getCreateVolumePayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getCreateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig); ok { + toSerialize["ImageConfig"] = val + } + if val, ok := getCreateVolumePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getCreateVolumePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateVolumePayloadGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getCreateVolumePayloadGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getCreateVolumePayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getCreateVolumePayloadGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + if val, ok := getCreateVolumePayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getCreateVolumePayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableCreateVolumePayload struct { + value *CreateVolumePayload + isSet bool +} + +func (v NullableCreateVolumePayload) Get() *CreateVolumePayload { + return v.value +} + +func (v *NullableCreateVolumePayload) Set(val *CreateVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateVolumePayload(val *CreateVolumePayload) *NullableCreateVolumePayload { + return &NullableCreateVolumePayload{value: val, isSet: true} +} + +func (v NullableCreateVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_destination_cidrv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_destination_cidrv4.go new file mode 100644 index 00000000..a2cce9d1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_destination_cidrv4.go @@ -0,0 +1,171 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the DestinationCIDRv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationCIDRv4{} + +/* + types and functions for type +*/ + +// isNotNullableString +type DestinationCIDRv4GetTypeAttributeType = *string + +func getDestinationCIDRv4GetTypeAttributeTypeOk(arg DestinationCIDRv4GetTypeAttributeType) (ret DestinationCIDRv4GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv4GetTypeAttributeType(arg *DestinationCIDRv4GetTypeAttributeType, val DestinationCIDRv4GetTypeRetType) { + *arg = &val +} + +type DestinationCIDRv4GetTypeArgType = string +type DestinationCIDRv4GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type DestinationCIDRv4GetValueAttributeType = *string + +func getDestinationCIDRv4GetValueAttributeTypeOk(arg DestinationCIDRv4GetValueAttributeType) (ret DestinationCIDRv4GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv4GetValueAttributeType(arg *DestinationCIDRv4GetValueAttributeType, val DestinationCIDRv4GetValueRetType) { + *arg = &val +} + +type DestinationCIDRv4GetValueArgType = string +type DestinationCIDRv4GetValueRetType = string + +// DestinationCIDRv4 IPv4 Classless Inter-Domain Routing (CIDR) Object. +type DestinationCIDRv4 struct { + // REQUIRED + Type DestinationCIDRv4GetTypeAttributeType `json:"type" required:"true"` + // An CIDRv4 string. + // REQUIRED + Value DestinationCIDRv4GetValueAttributeType `json:"value" required:"true"` +} + +type _DestinationCIDRv4 DestinationCIDRv4 + +// NewDestinationCIDRv4 instantiates a new DestinationCIDRv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDestinationCIDRv4(types DestinationCIDRv4GetTypeArgType, value DestinationCIDRv4GetValueArgType) *DestinationCIDRv4 { + this := DestinationCIDRv4{} + setDestinationCIDRv4GetTypeAttributeType(&this.Type, types) + setDestinationCIDRv4GetValueAttributeType(&this.Value, value) + return &this +} + +// NewDestinationCIDRv4WithDefaults instantiates a new DestinationCIDRv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDestinationCIDRv4WithDefaults() *DestinationCIDRv4 { + this := DestinationCIDRv4{} + return &this +} + +// GetType returns the Type field value +func (o *DestinationCIDRv4) GetType() (ret DestinationCIDRv4GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv4) GetTypeOk() (ret DestinationCIDRv4GetTypeRetType, ok bool) { + return getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *DestinationCIDRv4) SetType(v DestinationCIDRv4GetTypeRetType) { + setDestinationCIDRv4GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *DestinationCIDRv4) GetValue() (ret DestinationCIDRv4GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv4) GetValueOk() (ret DestinationCIDRv4GetValueRetType, ok bool) { + return getDestinationCIDRv4GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *DestinationCIDRv4) SetValue(v DestinationCIDRv4GetValueRetType) { + setDestinationCIDRv4GetValueAttributeType(&o.Value, v) +} + +func (o DestinationCIDRv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDestinationCIDRv4GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getDestinationCIDRv4GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableDestinationCIDRv4 struct { + value *DestinationCIDRv4 + isSet bool +} + +func (v NullableDestinationCIDRv4) Get() *DestinationCIDRv4 { + return v.value +} + +func (v *NullableDestinationCIDRv4) Set(val *DestinationCIDRv4) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationCIDRv4) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationCIDRv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationCIDRv4(val *DestinationCIDRv4) *NullableDestinationCIDRv4 { + return &NullableDestinationCIDRv4{value: val, isSet: true} +} + +func (v NullableDestinationCIDRv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationCIDRv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_destination_cidrv6.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_destination_cidrv6.go new file mode 100644 index 00000000..90fbc94a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_destination_cidrv6.go @@ -0,0 +1,171 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the DestinationCIDRv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DestinationCIDRv6{} + +/* + types and functions for type +*/ + +// isNotNullableString +type DestinationCIDRv6GetTypeAttributeType = *string + +func getDestinationCIDRv6GetTypeAttributeTypeOk(arg DestinationCIDRv6GetTypeAttributeType) (ret DestinationCIDRv6GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv6GetTypeAttributeType(arg *DestinationCIDRv6GetTypeAttributeType, val DestinationCIDRv6GetTypeRetType) { + *arg = &val +} + +type DestinationCIDRv6GetTypeArgType = string +type DestinationCIDRv6GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type DestinationCIDRv6GetValueAttributeType = *string + +func getDestinationCIDRv6GetValueAttributeTypeOk(arg DestinationCIDRv6GetValueAttributeType) (ret DestinationCIDRv6GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setDestinationCIDRv6GetValueAttributeType(arg *DestinationCIDRv6GetValueAttributeType, val DestinationCIDRv6GetValueRetType) { + *arg = &val +} + +type DestinationCIDRv6GetValueArgType = string +type DestinationCIDRv6GetValueRetType = string + +// DestinationCIDRv6 IPv6 Classless Inter-Domain Routing (CIDR) Object. +type DestinationCIDRv6 struct { + // REQUIRED + Type DestinationCIDRv6GetTypeAttributeType `json:"type" required:"true"` + // An CIDRv6 string. + // REQUIRED + Value DestinationCIDRv6GetValueAttributeType `json:"value" required:"true"` +} + +type _DestinationCIDRv6 DestinationCIDRv6 + +// NewDestinationCIDRv6 instantiates a new DestinationCIDRv6 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDestinationCIDRv6(types DestinationCIDRv6GetTypeArgType, value DestinationCIDRv6GetValueArgType) *DestinationCIDRv6 { + this := DestinationCIDRv6{} + setDestinationCIDRv6GetTypeAttributeType(&this.Type, types) + setDestinationCIDRv6GetValueAttributeType(&this.Value, value) + return &this +} + +// NewDestinationCIDRv6WithDefaults instantiates a new DestinationCIDRv6 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDestinationCIDRv6WithDefaults() *DestinationCIDRv6 { + this := DestinationCIDRv6{} + return &this +} + +// GetType returns the Type field value +func (o *DestinationCIDRv6) GetType() (ret DestinationCIDRv6GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv6) GetTypeOk() (ret DestinationCIDRv6GetTypeRetType, ok bool) { + return getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *DestinationCIDRv6) SetType(v DestinationCIDRv6GetTypeRetType) { + setDestinationCIDRv6GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *DestinationCIDRv6) GetValue() (ret DestinationCIDRv6GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *DestinationCIDRv6) GetValueOk() (ret DestinationCIDRv6GetValueRetType, ok bool) { + return getDestinationCIDRv6GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *DestinationCIDRv6) SetValue(v DestinationCIDRv6GetValueRetType) { + setDestinationCIDRv6GetValueAttributeType(&o.Value, v) +} + +func (o DestinationCIDRv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getDestinationCIDRv6GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getDestinationCIDRv6GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableDestinationCIDRv6 struct { + value *DestinationCIDRv6 + isSet bool +} + +func (v NullableDestinationCIDRv6) Get() *DestinationCIDRv6 { + return v.value +} + +func (v *NullableDestinationCIDRv6) Set(val *DestinationCIDRv6) { + v.value = val + v.isSet = true +} + +func (v NullableDestinationCIDRv6) IsSet() bool { + return v.isSet +} + +func (v *NullableDestinationCIDRv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDestinationCIDRv6(val *DestinationCIDRv6) *NullableDestinationCIDRv6 { + return &NullableDestinationCIDRv6{value: val, isSet: true} +} + +func (v NullableDestinationCIDRv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDestinationCIDRv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_error.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_error.go new file mode 100644 index 00000000..7c01cddf --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_error.go @@ -0,0 +1,170 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + +/* + types and functions for code +*/ + +// isLong +type ErrorGetCodeAttributeType = *int64 +type ErrorGetCodeArgType = int64 +type ErrorGetCodeRetType = int64 + +func getErrorGetCodeAttributeTypeOk(arg ErrorGetCodeAttributeType) (ret ErrorGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetCodeAttributeType(arg *ErrorGetCodeAttributeType, val ErrorGetCodeRetType) { + *arg = &val +} + +/* + types and functions for msg +*/ + +// isNotNullableString +type ErrorGetMsgAttributeType = *string + +func getErrorGetMsgAttributeTypeOk(arg ErrorGetMsgAttributeType) (ret ErrorGetMsgRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorGetMsgAttributeType(arg *ErrorGetMsgAttributeType, val ErrorGetMsgRetType) { + *arg = &val +} + +type ErrorGetMsgArgType = string +type ErrorGetMsgRetType = string + +// Error Error with HTTP error code and an error message. +type Error struct { + // REQUIRED + Code ErrorGetCodeAttributeType `json:"code" required:"true"` + // An error message. + // REQUIRED + Msg ErrorGetMsgAttributeType `json:"msg" required:"true"` +} + +type _Error Error + +// NewError instantiates a new Error object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewError(code ErrorGetCodeArgType, msg ErrorGetMsgArgType) *Error { + this := Error{} + setErrorGetCodeAttributeType(&this.Code, code) + setErrorGetMsgAttributeType(&this.Msg, msg) + return &this +} + +// NewErrorWithDefaults instantiates a new Error object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewErrorWithDefaults() *Error { + this := Error{} + return &this +} + +// GetCode returns the Code field value +func (o *Error) GetCode() (ret ErrorGetCodeRetType) { + ret, _ = o.GetCodeOk() + return ret +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *Error) GetCodeOk() (ret ErrorGetCodeRetType, ok bool) { + return getErrorGetCodeAttributeTypeOk(o.Code) +} + +// SetCode sets field value +func (o *Error) SetCode(v ErrorGetCodeRetType) { + setErrorGetCodeAttributeType(&o.Code, v) +} + +// GetMsg returns the Msg field value +func (o *Error) GetMsg() (ret ErrorGetMsgRetType) { + ret, _ = o.GetMsgOk() + return ret +} + +// GetMsgOk returns a tuple with the Msg field value +// and a boolean to check if the value has been set. +func (o *Error) GetMsgOk() (ret ErrorGetMsgRetType, ok bool) { + return getErrorGetMsgAttributeTypeOk(o.Msg) +} + +// SetMsg sets field value +func (o *Error) SetMsg(v ErrorGetMsgRetType) { + setErrorGetMsgAttributeType(&o.Msg, v) +} + +func (o Error) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getErrorGetMsgAttributeTypeOk(o.Msg); ok { + toSerialize["Msg"] = val + } + return toSerialize, nil +} + +type NullableError struct { + value *Error + isSet bool +} + +func (v NullableError) Get() *Error { + return v.value +} + +func (v *NullableError) Set(val *Error) { + v.value = val + v.isSet = true +} + +func (v NullableError) IsSet() bool { + return v.isSet +} + +func (v *NullableError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableError(val *Error) *NullableError { + return &NullableError{value: val, isSet: true} +} + +func (v NullableError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_get_server_log_200_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_get_server_log_200_response.go new file mode 100644 index 00000000..5d82b69a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_get_server_log_200_response.go @@ -0,0 +1,128 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the GetServerLog200Response type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetServerLog200Response{} + +/* + types and functions for output +*/ + +// isNotNullableString +type GetServerLog200ResponseGetOutputAttributeType = *string + +func getGetServerLog200ResponseGetOutputAttributeTypeOk(arg GetServerLog200ResponseGetOutputAttributeType) (ret GetServerLog200ResponseGetOutputRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGetServerLog200ResponseGetOutputAttributeType(arg *GetServerLog200ResponseGetOutputAttributeType, val GetServerLog200ResponseGetOutputRetType) { + *arg = &val +} + +type GetServerLog200ResponseGetOutputArgType = string +type GetServerLog200ResponseGetOutputRetType = string + +// GetServerLog200Response struct for GetServerLog200Response +type GetServerLog200Response struct { + Output GetServerLog200ResponseGetOutputAttributeType `json:"output,omitempty"` +} + +// NewGetServerLog200Response instantiates a new GetServerLog200Response object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewGetServerLog200Response() *GetServerLog200Response { + this := GetServerLog200Response{} + return &this +} + +// NewGetServerLog200ResponseWithDefaults instantiates a new GetServerLog200Response object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetServerLog200ResponseWithDefaults() *GetServerLog200Response { + this := GetServerLog200Response{} + return &this +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *GetServerLog200Response) GetOutput() (res GetServerLog200ResponseGetOutputRetType) { + res, _ = o.GetOutputOk() + return +} + +// GetOutputOk returns a tuple with the Output field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetServerLog200Response) GetOutputOk() (ret GetServerLog200ResponseGetOutputRetType, ok bool) { + return getGetServerLog200ResponseGetOutputAttributeTypeOk(o.Output) +} + +// HasOutput returns a boolean if a field has been set. +func (o *GetServerLog200Response) HasOutput() bool { + _, ok := o.GetOutputOk() + return ok +} + +// SetOutput gets a reference to the given string and assigns it to the Output field. +func (o *GetServerLog200Response) SetOutput(v GetServerLog200ResponseGetOutputRetType) { + setGetServerLog200ResponseGetOutputAttributeType(&o.Output, v) +} + +func (o GetServerLog200Response) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGetServerLog200ResponseGetOutputAttributeTypeOk(o.Output); ok { + toSerialize["Output"] = val + } + return toSerialize, nil +} + +type NullableGetServerLog200Response struct { + value *GetServerLog200Response + isSet bool +} + +func (v NullableGetServerLog200Response) Get() *GetServerLog200Response { + return v.value +} + +func (v *NullableGetServerLog200Response) Set(val *GetServerLog200Response) { + v.value = val + v.isSet = true +} + +func (v NullableGetServerLog200Response) IsSet() bool { + return v.isSet +} + +func (v *NullableGetServerLog200Response) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetServerLog200Response(val *GetServerLog200Response) *NullableGetServerLog200Response { + return &NullableGetServerLog200Response{value: val, isSet: true} +} + +func (v NullableGetServerLog200Response) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetServerLog200Response) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_icmp_parameters.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_icmp_parameters.go new file mode 100644 index 00000000..90ebc806 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_icmp_parameters.go @@ -0,0 +1,170 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ICMPParameters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ICMPParameters{} + +/* + types and functions for code +*/ + +// isLong +type ICMPParametersGetCodeAttributeType = *int64 +type ICMPParametersGetCodeArgType = int64 +type ICMPParametersGetCodeRetType = int64 + +func getICMPParametersGetCodeAttributeTypeOk(arg ICMPParametersGetCodeAttributeType) (ret ICMPParametersGetCodeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setICMPParametersGetCodeAttributeType(arg *ICMPParametersGetCodeAttributeType, val ICMPParametersGetCodeRetType) { + *arg = &val +} + +/* + types and functions for type +*/ + +// isLong +type ICMPParametersGetTypeAttributeType = *int64 +type ICMPParametersGetTypeArgType = int64 +type ICMPParametersGetTypeRetType = int64 + +func getICMPParametersGetTypeAttributeTypeOk(arg ICMPParametersGetTypeAttributeType) (ret ICMPParametersGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setICMPParametersGetTypeAttributeType(arg *ICMPParametersGetTypeAttributeType, val ICMPParametersGetTypeRetType) { + *arg = &val +} + +// ICMPParameters Object that represents ICMP parameters. +type ICMPParameters struct { + // ICMP code. Can be set if the protocol is ICMP. + // REQUIRED + Code ICMPParametersGetCodeAttributeType `json:"code" required:"true"` + // ICMP type. Can be set if the protocol is ICMP. + // REQUIRED + Type ICMPParametersGetTypeAttributeType `json:"type" required:"true"` +} + +type _ICMPParameters ICMPParameters + +// NewICMPParameters instantiates a new ICMPParameters object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewICMPParameters(code ICMPParametersGetCodeArgType, types ICMPParametersGetTypeArgType) *ICMPParameters { + this := ICMPParameters{} + setICMPParametersGetCodeAttributeType(&this.Code, code) + setICMPParametersGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewICMPParametersWithDefaults instantiates a new ICMPParameters object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewICMPParametersWithDefaults() *ICMPParameters { + this := ICMPParameters{} + return &this +} + +// GetCode returns the Code field value +func (o *ICMPParameters) GetCode() (ret ICMPParametersGetCodeRetType) { + ret, _ = o.GetCodeOk() + return ret +} + +// GetCodeOk returns a tuple with the Code field value +// and a boolean to check if the value has been set. +func (o *ICMPParameters) GetCodeOk() (ret ICMPParametersGetCodeRetType, ok bool) { + return getICMPParametersGetCodeAttributeTypeOk(o.Code) +} + +// SetCode sets field value +func (o *ICMPParameters) SetCode(v ICMPParametersGetCodeRetType) { + setICMPParametersGetCodeAttributeType(&o.Code, v) +} + +// GetType returns the Type field value +func (o *ICMPParameters) GetType() (ret ICMPParametersGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ICMPParameters) GetTypeOk() (ret ICMPParametersGetTypeRetType, ok bool) { + return getICMPParametersGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *ICMPParameters) SetType(v ICMPParametersGetTypeRetType) { + setICMPParametersGetTypeAttributeType(&o.Type, v) +} + +func (o ICMPParameters) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getICMPParametersGetCodeAttributeTypeOk(o.Code); ok { + toSerialize["Code"] = val + } + if val, ok := getICMPParametersGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableICMPParameters struct { + value *ICMPParameters + isSet bool +} + +func (v NullableICMPParameters) Get() *ICMPParameters { + return v.value +} + +func (v *NullableICMPParameters) Set(val *ICMPParameters) { + v.value = val + v.isSet = true +} + +func (v NullableICMPParameters) IsSet() bool { + return v.isSet +} + +func (v *NullableICMPParameters) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableICMPParameters(val *ICMPParameters) *NullableICMPParameters { + return &NullableICMPParameters{value: val, isSet: true} +} + +func (v NullableICMPParameters) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableICMPParameters) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image.go new file mode 100644 index 00000000..fa53b513 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image.go @@ -0,0 +1,846 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Image type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Image{} + +/* + types and functions for agent +*/ + +// isModel +type ImageGetAgentAttributeType = *ImageAgent +type ImageGetAgentArgType = ImageAgent +type ImageGetAgentRetType = ImageAgent + +func getImageGetAgentAttributeTypeOk(arg ImageGetAgentAttributeType) (ret ImageGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetAgentAttributeType(arg *ImageGetAgentAttributeType, val ImageGetAgentRetType) { + *arg = &val +} + +/* + types and functions for checksum +*/ + +// isModel +type ImageGetChecksumAttributeType = *ImageChecksum +type ImageGetChecksumArgType = ImageChecksum +type ImageGetChecksumRetType = ImageChecksum + +func getImageGetChecksumAttributeTypeOk(arg ImageGetChecksumAttributeType) (ret ImageGetChecksumRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetChecksumAttributeType(arg *ImageGetChecksumAttributeType, val ImageGetChecksumRetType) { + *arg = &val +} + +/* + types and functions for config +*/ + +// isModel +type ImageGetConfigAttributeType = *ImageConfig +type ImageGetConfigArgType = ImageConfig +type ImageGetConfigRetType = ImageConfig + +func getImageGetConfigAttributeTypeOk(arg ImageGetConfigAttributeType) (ret ImageGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetConfigAttributeType(arg *ImageGetConfigAttributeType, val ImageGetConfigRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ImageGetCreatedAtAttributeType = *time.Time +type ImageGetCreatedAtArgType = time.Time +type ImageGetCreatedAtRetType = time.Time + +func getImageGetCreatedAtAttributeTypeOk(arg ImageGetCreatedAtAttributeType) (ret ImageGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetCreatedAtAttributeType(arg *ImageGetCreatedAtAttributeType, val ImageGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for diskFormat +*/ + +// isNotNullableString +type ImageGetDiskFormatAttributeType = *string + +func getImageGetDiskFormatAttributeTypeOk(arg ImageGetDiskFormatAttributeType) (ret ImageGetDiskFormatRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetDiskFormatAttributeType(arg *ImageGetDiskFormatAttributeType, val ImageGetDiskFormatRetType) { + *arg = &val +} + +type ImageGetDiskFormatArgType = string +type ImageGetDiskFormatRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type ImageGetIdAttributeType = *string + +func getImageGetIdAttributeTypeOk(arg ImageGetIdAttributeType) (ret ImageGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetIdAttributeType(arg *ImageGetIdAttributeType, val ImageGetIdRetType) { + *arg = &val +} + +type ImageGetIdArgType = string +type ImageGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type ImageGetLabelsAttributeType = *map[string]interface{} +type ImageGetLabelsArgType = map[string]interface{} +type ImageGetLabelsRetType = map[string]interface{} + +func getImageGetLabelsAttributeTypeOk(arg ImageGetLabelsAttributeType) (ret ImageGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetLabelsAttributeType(arg *ImageGetLabelsAttributeType, val ImageGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for minDiskSize +*/ + +// isLong +type ImageGetMinDiskSizeAttributeType = *int64 +type ImageGetMinDiskSizeArgType = int64 +type ImageGetMinDiskSizeRetType = int64 + +func getImageGetMinDiskSizeAttributeTypeOk(arg ImageGetMinDiskSizeAttributeType) (ret ImageGetMinDiskSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetMinDiskSizeAttributeType(arg *ImageGetMinDiskSizeAttributeType, val ImageGetMinDiskSizeRetType) { + *arg = &val +} + +/* + types and functions for minRam +*/ + +// isLong +type ImageGetMinRamAttributeType = *int64 +type ImageGetMinRamArgType = int64 +type ImageGetMinRamRetType = int64 + +func getImageGetMinRamAttributeTypeOk(arg ImageGetMinRamAttributeType) (ret ImageGetMinRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetMinRamAttributeType(arg *ImageGetMinRamAttributeType, val ImageGetMinRamRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ImageGetNameAttributeType = *string + +func getImageGetNameAttributeTypeOk(arg ImageGetNameAttributeType) (ret ImageGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetNameAttributeType(arg *ImageGetNameAttributeType, val ImageGetNameRetType) { + *arg = &val +} + +type ImageGetNameArgType = string +type ImageGetNameRetType = string + +/* + types and functions for owner +*/ + +// isNotNullableString +type ImageGetOwnerAttributeType = *string + +func getImageGetOwnerAttributeTypeOk(arg ImageGetOwnerAttributeType) (ret ImageGetOwnerRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetOwnerAttributeType(arg *ImageGetOwnerAttributeType, val ImageGetOwnerRetType) { + *arg = &val +} + +type ImageGetOwnerArgType = string +type ImageGetOwnerRetType = string + +/* + types and functions for protected +*/ + +// isBoolean +type ImagegetProtectedAttributeType = *bool +type ImagegetProtectedArgType = bool +type ImagegetProtectedRetType = bool + +func getImagegetProtectedAttributeTypeOk(arg ImagegetProtectedAttributeType) (ret ImagegetProtectedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImagegetProtectedAttributeType(arg *ImagegetProtectedAttributeType, val ImagegetProtectedRetType) { + *arg = &val +} + +/* + types and functions for scope +*/ + +// isNotNullableString +type ImageGetScopeAttributeType = *string + +func getImageGetScopeAttributeTypeOk(arg ImageGetScopeAttributeType) (ret ImageGetScopeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetScopeAttributeType(arg *ImageGetScopeAttributeType, val ImageGetScopeRetType) { + *arg = &val +} + +type ImageGetScopeArgType = string +type ImageGetScopeRetType = string + +/* + types and functions for size +*/ + +// isLong +type ImageGetSizeAttributeType = *int64 +type ImageGetSizeArgType = int64 +type ImageGetSizeRetType = int64 + +func getImageGetSizeAttributeTypeOk(arg ImageGetSizeAttributeType) (ret ImageGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetSizeAttributeType(arg *ImageGetSizeAttributeType, val ImageGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ImageGetStatusAttributeType = *string + +func getImageGetStatusAttributeTypeOk(arg ImageGetStatusAttributeType) (ret ImageGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetStatusAttributeType(arg *ImageGetStatusAttributeType, val ImageGetStatusRetType) { + *arg = &val +} + +type ImageGetStatusArgType = string +type ImageGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ImageGetUpdatedAtAttributeType = *time.Time +type ImageGetUpdatedAtArgType = time.Time +type ImageGetUpdatedAtRetType = time.Time + +func getImageGetUpdatedAtAttributeTypeOk(arg ImageGetUpdatedAtAttributeType) (ret ImageGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageGetUpdatedAtAttributeType(arg *ImageGetUpdatedAtAttributeType, val ImageGetUpdatedAtRetType) { + *arg = &val +} + +// Image Object that represents an Image and its parameters. Used for Creating and returning (get/list). +type Image struct { + Agent ImageGetAgentAttributeType `json:"agent,omitempty"` + Checksum ImageGetChecksumAttributeType `json:"checksum,omitempty"` + Config ImageGetConfigAttributeType `json:"config,omitempty"` + // Date-time when resource was created. + CreatedAt ImageGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. + // REQUIRED + DiskFormat ImageGetDiskFormatAttributeType `json:"diskFormat" required:"true"` + // Universally Unique Identifier (UUID). + Id ImageGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels ImageGetLabelsAttributeType `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize ImageGetMinDiskSizeAttributeType `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam ImageGetMinRamAttributeType `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name ImageGetNameAttributeType `json:"name" required:"true"` + // Universally Unique Identifier (UUID). + Owner ImageGetOwnerAttributeType `json:"owner,omitempty"` + // When true the image is prevented from being deleted. + Protected ImagegetProtectedAttributeType `json:"protected,omitempty"` + // Scope of an Image. Possible values: `public`, `local`, `projects`, `organization`. + Scope ImageGetScopeAttributeType `json:"scope,omitempty"` + // Size in bytes. + Size ImageGetSizeAttributeType `json:"size,omitempty"` + // The status of an image object. Possible values: `AVAILABLE`, `CREATING`, `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. + Status ImageGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt ImageGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Image Image + +// NewImage instantiates a new Image object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImage(diskFormat ImageGetDiskFormatArgType, name ImageGetNameArgType) *Image { + this := Image{} + setImageGetDiskFormatAttributeType(&this.DiskFormat, diskFormat) + setImageGetNameAttributeType(&this.Name, name) + return &this +} + +// NewImageWithDefaults instantiates a new Image object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageWithDefaults() *Image { + this := Image{} + return &this +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *Image) GetAgent() (res ImageGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetAgentOk() (ret ImageGetAgentRetType, ok bool) { + return getImageGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *Image) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ImageAgent and assigns it to the Agent field. +func (o *Image) SetAgent(v ImageGetAgentRetType) { + setImageGetAgentAttributeType(&o.Agent, v) +} + +// GetChecksum returns the Checksum field value if set, zero value otherwise. +func (o *Image) GetChecksum() (res ImageGetChecksumRetType) { + res, _ = o.GetChecksumOk() + return +} + +// GetChecksumOk returns a tuple with the Checksum field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetChecksumOk() (ret ImageGetChecksumRetType, ok bool) { + return getImageGetChecksumAttributeTypeOk(o.Checksum) +} + +// HasChecksum returns a boolean if a field has been set. +func (o *Image) HasChecksum() bool { + _, ok := o.GetChecksumOk() + return ok +} + +// SetChecksum gets a reference to the given ImageChecksum and assigns it to the Checksum field. +func (o *Image) SetChecksum(v ImageGetChecksumRetType) { + setImageGetChecksumAttributeType(&o.Checksum, v) +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *Image) GetConfig() (res ImageGetConfigRetType) { + res, _ = o.GetConfigOk() + return +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetConfigOk() (ret ImageGetConfigRetType, ok bool) { + return getImageGetConfigAttributeTypeOk(o.Config) +} + +// HasConfig returns a boolean if a field has been set. +func (o *Image) HasConfig() bool { + _, ok := o.GetConfigOk() + return ok +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *Image) SetConfig(v ImageGetConfigRetType) { + setImageGetConfigAttributeType(&o.Config, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Image) GetCreatedAt() (res ImageGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetCreatedAtOk() (ret ImageGetCreatedAtRetType, ok bool) { + return getImageGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Image) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Image) SetCreatedAt(v ImageGetCreatedAtRetType) { + setImageGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDiskFormat returns the DiskFormat field value +func (o *Image) GetDiskFormat() (ret ImageGetDiskFormatRetType) { + ret, _ = o.GetDiskFormatOk() + return ret +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value +// and a boolean to check if the value has been set. +func (o *Image) GetDiskFormatOk() (ret ImageGetDiskFormatRetType, ok bool) { + return getImageGetDiskFormatAttributeTypeOk(o.DiskFormat) +} + +// SetDiskFormat sets field value +func (o *Image) SetDiskFormat(v ImageGetDiskFormatRetType) { + setImageGetDiskFormatAttributeType(&o.DiskFormat, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Image) GetId() (res ImageGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetIdOk() (ret ImageGetIdRetType, ok bool) { + return getImageGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Image) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Image) SetId(v ImageGetIdRetType) { + setImageGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Image) GetLabels() (res ImageGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetLabelsOk() (ret ImageGetLabelsRetType, ok bool) { + return getImageGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Image) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Image) SetLabels(v ImageGetLabelsRetType) { + setImageGetLabelsAttributeType(&o.Labels, v) +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *Image) GetMinDiskSize() (res ImageGetMinDiskSizeRetType) { + res, _ = o.GetMinDiskSizeOk() + return +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinDiskSizeOk() (ret ImageGetMinDiskSizeRetType, ok bool) { + return getImageGetMinDiskSizeAttributeTypeOk(o.MinDiskSize) +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *Image) HasMinDiskSize() bool { + _, ok := o.GetMinDiskSizeOk() + return ok +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *Image) SetMinDiskSize(v ImageGetMinDiskSizeRetType) { + setImageGetMinDiskSizeAttributeType(&o.MinDiskSize, v) +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *Image) GetMinRam() (res ImageGetMinRamRetType) { + res, _ = o.GetMinRamOk() + return +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetMinRamOk() (ret ImageGetMinRamRetType, ok bool) { + return getImageGetMinRamAttributeTypeOk(o.MinRam) +} + +// HasMinRam returns a boolean if a field has been set. +func (o *Image) HasMinRam() bool { + _, ok := o.GetMinRamOk() + return ok +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *Image) SetMinRam(v ImageGetMinRamRetType) { + setImageGetMinRamAttributeType(&o.MinRam, v) +} + +// GetName returns the Name field value +func (o *Image) GetName() (ret ImageGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Image) GetNameOk() (ret ImageGetNameRetType, ok bool) { + return getImageGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Image) SetName(v ImageGetNameRetType) { + setImageGetNameAttributeType(&o.Name, v) +} + +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *Image) GetOwner() (res ImageGetOwnerRetType) { + res, _ = o.GetOwnerOk() + return +} + +// GetOwnerOk returns a tuple with the Owner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetOwnerOk() (ret ImageGetOwnerRetType, ok bool) { + return getImageGetOwnerAttributeTypeOk(o.Owner) +} + +// HasOwner returns a boolean if a field has been set. +func (o *Image) HasOwner() bool { + _, ok := o.GetOwnerOk() + return ok +} + +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *Image) SetOwner(v ImageGetOwnerRetType) { + setImageGetOwnerAttributeType(&o.Owner, v) +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *Image) GetProtected() (res ImagegetProtectedRetType) { + res, _ = o.GetProtectedOk() + return +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetProtectedOk() (ret ImagegetProtectedRetType, ok bool) { + return getImagegetProtectedAttributeTypeOk(o.Protected) +} + +// HasProtected returns a boolean if a field has been set. +func (o *Image) HasProtected() bool { + _, ok := o.GetProtectedOk() + return ok +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *Image) SetProtected(v ImagegetProtectedRetType) { + setImagegetProtectedAttributeType(&o.Protected, v) +} + +// GetScope returns the Scope field value if set, zero value otherwise. +func (o *Image) GetScope() (res ImageGetScopeRetType) { + res, _ = o.GetScopeOk() + return +} + +// GetScopeOk returns a tuple with the Scope field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetScopeOk() (ret ImageGetScopeRetType, ok bool) { + return getImageGetScopeAttributeTypeOk(o.Scope) +} + +// HasScope returns a boolean if a field has been set. +func (o *Image) HasScope() bool { + _, ok := o.GetScopeOk() + return ok +} + +// SetScope gets a reference to the given string and assigns it to the Scope field. +func (o *Image) SetScope(v ImageGetScopeRetType) { + setImageGetScopeAttributeType(&o.Scope, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Image) GetSize() (res ImageGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetSizeOk() (ret ImageGetSizeRetType, ok bool) { + return getImageGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Image) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Image) SetSize(v ImageGetSizeRetType) { + setImageGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Image) GetStatus() (res ImageGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetStatusOk() (ret ImageGetStatusRetType, ok bool) { + return getImageGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Image) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Image) SetStatus(v ImageGetStatusRetType) { + setImageGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Image) GetUpdatedAt() (res ImageGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetUpdatedAtOk() (ret ImageGetUpdatedAtRetType, ok bool) { + return getImageGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Image) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Image) SetUpdatedAt(v ImageGetUpdatedAtRetType) { + setImageGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Image) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getImageGetChecksumAttributeTypeOk(o.Checksum); ok { + toSerialize["Checksum"] = val + } + if val, ok := getImageGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getImageGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getImageGetDiskFormatAttributeTypeOk(o.DiskFormat); ok { + toSerialize["DiskFormat"] = val + } + if val, ok := getImageGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getImageGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getImageGetMinDiskSizeAttributeTypeOk(o.MinDiskSize); ok { + toSerialize["MinDiskSize"] = val + } + if val, ok := getImageGetMinRamAttributeTypeOk(o.MinRam); ok { + toSerialize["MinRam"] = val + } + if val, ok := getImageGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getImageGetOwnerAttributeTypeOk(o.Owner); ok { + toSerialize["Owner"] = val + } + if val, ok := getImagegetProtectedAttributeTypeOk(o.Protected); ok { + toSerialize["Protected"] = val + } + if val, ok := getImageGetScopeAttributeTypeOk(o.Scope); ok { + toSerialize["Scope"] = val + } + if val, ok := getImageGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getImageGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getImageGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableImage struct { + value *Image + isSet bool +} + +func (v NullableImage) Get() *Image { + return v.value +} + +func (v *NullableImage) Set(val *Image) { + v.value = val + v.isSet = true +} + +func (v NullableImage) IsSet() bool { + return v.isSet +} + +func (v *NullableImage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImage(val *Image) *NullableImage { + return &NullableImage{value: val, isSet: true} +} + +func (v NullableImage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_agent.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_agent.go new file mode 100644 index 00000000..3f1ccf81 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_agent.go @@ -0,0 +1,176 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageAgent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageAgent{} + +/* + types and functions for provisionByDefault +*/ + +// isBoolean +type ImageAgentgetProvisionByDefaultAttributeType = *bool +type ImageAgentgetProvisionByDefaultArgType = bool +type ImageAgentgetProvisionByDefaultRetType = bool + +func getImageAgentgetProvisionByDefaultAttributeTypeOk(arg ImageAgentgetProvisionByDefaultAttributeType) (ret ImageAgentgetProvisionByDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageAgentgetProvisionByDefaultAttributeType(arg *ImageAgentgetProvisionByDefaultAttributeType, val ImageAgentgetProvisionByDefaultRetType) { + *arg = &val +} + +/* + types and functions for supported +*/ + +// isBoolean +type ImageAgentgetSupportedAttributeType = *bool +type ImageAgentgetSupportedArgType = bool +type ImageAgentgetSupportedRetType = bool + +func getImageAgentgetSupportedAttributeTypeOk(arg ImageAgentgetSupportedAttributeType) (ret ImageAgentgetSupportedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageAgentgetSupportedAttributeType(arg *ImageAgentgetSupportedAttributeType, val ImageAgentgetSupportedRetType) { + *arg = &val +} + +// ImageAgent Support status and default provioning setting for the STACKIT server agent. +type ImageAgent struct { + // Default provioning of the STACKIT server agent for new servers. The default for new images is false. Can only be enabled when supported is also true. + ProvisionByDefault ImageAgentgetProvisionByDefaultAttributeType `json:"provisionByDefault,omitempty"` + // Indicates the STACKIT server agent for the image. The default for new images is false. + Supported ImageAgentgetSupportedAttributeType `json:"supported,omitempty"` +} + +// NewImageAgent instantiates a new ImageAgent object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageAgent() *ImageAgent { + this := ImageAgent{} + return &this +} + +// NewImageAgentWithDefaults instantiates a new ImageAgent object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageAgentWithDefaults() *ImageAgent { + this := ImageAgent{} + return &this +} + +// GetProvisionByDefault returns the ProvisionByDefault field value if set, zero value otherwise. +func (o *ImageAgent) GetProvisionByDefault() (res ImageAgentgetProvisionByDefaultRetType) { + res, _ = o.GetProvisionByDefaultOk() + return +} + +// GetProvisionByDefaultOk returns a tuple with the ProvisionByDefault field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageAgent) GetProvisionByDefaultOk() (ret ImageAgentgetProvisionByDefaultRetType, ok bool) { + return getImageAgentgetProvisionByDefaultAttributeTypeOk(o.ProvisionByDefault) +} + +// HasProvisionByDefault returns a boolean if a field has been set. +func (o *ImageAgent) HasProvisionByDefault() bool { + _, ok := o.GetProvisionByDefaultOk() + return ok +} + +// SetProvisionByDefault gets a reference to the given bool and assigns it to the ProvisionByDefault field. +func (o *ImageAgent) SetProvisionByDefault(v ImageAgentgetProvisionByDefaultRetType) { + setImageAgentgetProvisionByDefaultAttributeType(&o.ProvisionByDefault, v) +} + +// GetSupported returns the Supported field value if set, zero value otherwise. +func (o *ImageAgent) GetSupported() (res ImageAgentgetSupportedRetType) { + res, _ = o.GetSupportedOk() + return +} + +// GetSupportedOk returns a tuple with the Supported field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageAgent) GetSupportedOk() (ret ImageAgentgetSupportedRetType, ok bool) { + return getImageAgentgetSupportedAttributeTypeOk(o.Supported) +} + +// HasSupported returns a boolean if a field has been set. +func (o *ImageAgent) HasSupported() bool { + _, ok := o.GetSupportedOk() + return ok +} + +// SetSupported gets a reference to the given bool and assigns it to the Supported field. +func (o *ImageAgent) SetSupported(v ImageAgentgetSupportedRetType) { + setImageAgentgetSupportedAttributeType(&o.Supported, v) +} + +func (o ImageAgent) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageAgentgetProvisionByDefaultAttributeTypeOk(o.ProvisionByDefault); ok { + toSerialize["ProvisionByDefault"] = val + } + if val, ok := getImageAgentgetSupportedAttributeTypeOk(o.Supported); ok { + toSerialize["Supported"] = val + } + return toSerialize, nil +} + +type NullableImageAgent struct { + value *ImageAgent + isSet bool +} + +func (v NullableImageAgent) Get() *ImageAgent { + return v.value +} + +func (v *NullableImageAgent) Set(val *ImageAgent) { + v.value = val + v.isSet = true +} + +func (v NullableImageAgent) IsSet() bool { + return v.isSet +} + +func (v *NullableImageAgent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageAgent(val *ImageAgent) *NullableImageAgent { + return &NullableImageAgent{value: val, isSet: true} +} + +func (v NullableImageAgent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageAgent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_checksum.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_checksum.go new file mode 100644 index 00000000..e0802181 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_checksum.go @@ -0,0 +1,172 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageChecksum type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageChecksum{} + +/* + types and functions for algorithm +*/ + +// isNotNullableString +type ImageChecksumGetAlgorithmAttributeType = *string + +func getImageChecksumGetAlgorithmAttributeTypeOk(arg ImageChecksumGetAlgorithmAttributeType) (ret ImageChecksumGetAlgorithmRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageChecksumGetAlgorithmAttributeType(arg *ImageChecksumGetAlgorithmAttributeType, val ImageChecksumGetAlgorithmRetType) { + *arg = &val +} + +type ImageChecksumGetAlgorithmArgType = string +type ImageChecksumGetAlgorithmRetType = string + +/* + types and functions for digest +*/ + +// isNotNullableString +type ImageChecksumGetDigestAttributeType = *string + +func getImageChecksumGetDigestAttributeTypeOk(arg ImageChecksumGetDigestAttributeType) (ret ImageChecksumGetDigestRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageChecksumGetDigestAttributeType(arg *ImageChecksumGetDigestAttributeType, val ImageChecksumGetDigestRetType) { + *arg = &val +} + +type ImageChecksumGetDigestArgType = string +type ImageChecksumGetDigestRetType = string + +// ImageChecksum Representation of an image checksum. +type ImageChecksum struct { + // Algorithm for the checksum of the image data. Possible values: `md5`, `sha512`. + // REQUIRED + Algorithm ImageChecksumGetAlgorithmAttributeType `json:"algorithm" required:"true"` + // Hexdigest of the checksum of the image data. + // REQUIRED + Digest ImageChecksumGetDigestAttributeType `json:"digest" required:"true"` +} + +type _ImageChecksum ImageChecksum + +// NewImageChecksum instantiates a new ImageChecksum object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageChecksum(algorithm ImageChecksumGetAlgorithmArgType, digest ImageChecksumGetDigestArgType) *ImageChecksum { + this := ImageChecksum{} + setImageChecksumGetAlgorithmAttributeType(&this.Algorithm, algorithm) + setImageChecksumGetDigestAttributeType(&this.Digest, digest) + return &this +} + +// NewImageChecksumWithDefaults instantiates a new ImageChecksum object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageChecksumWithDefaults() *ImageChecksum { + this := ImageChecksum{} + return &this +} + +// GetAlgorithm returns the Algorithm field value +func (o *ImageChecksum) GetAlgorithm() (ret ImageChecksumGetAlgorithmRetType) { + ret, _ = o.GetAlgorithmOk() + return ret +} + +// GetAlgorithmOk returns a tuple with the Algorithm field value +// and a boolean to check if the value has been set. +func (o *ImageChecksum) GetAlgorithmOk() (ret ImageChecksumGetAlgorithmRetType, ok bool) { + return getImageChecksumGetAlgorithmAttributeTypeOk(o.Algorithm) +} + +// SetAlgorithm sets field value +func (o *ImageChecksum) SetAlgorithm(v ImageChecksumGetAlgorithmRetType) { + setImageChecksumGetAlgorithmAttributeType(&o.Algorithm, v) +} + +// GetDigest returns the Digest field value +func (o *ImageChecksum) GetDigest() (ret ImageChecksumGetDigestRetType) { + ret, _ = o.GetDigestOk() + return ret +} + +// GetDigestOk returns a tuple with the Digest field value +// and a boolean to check if the value has been set. +func (o *ImageChecksum) GetDigestOk() (ret ImageChecksumGetDigestRetType, ok bool) { + return getImageChecksumGetDigestAttributeTypeOk(o.Digest) +} + +// SetDigest sets field value +func (o *ImageChecksum) SetDigest(v ImageChecksumGetDigestRetType) { + setImageChecksumGetDigestAttributeType(&o.Digest, v) +} + +func (o ImageChecksum) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageChecksumGetAlgorithmAttributeTypeOk(o.Algorithm); ok { + toSerialize["Algorithm"] = val + } + if val, ok := getImageChecksumGetDigestAttributeTypeOk(o.Digest); ok { + toSerialize["Digest"] = val + } + return toSerialize, nil +} + +type NullableImageChecksum struct { + value *ImageChecksum + isSet bool +} + +func (v NullableImageChecksum) Get() *ImageChecksum { + return v.value +} + +func (v *NullableImageChecksum) Set(val *ImageChecksum) { + v.value = val + v.isSet = true +} + +func (v NullableImageChecksum) IsSet() bool { + return v.isSet +} + +func (v *NullableImageChecksum) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageChecksum(val *ImageChecksum) *NullableImageChecksum { + return &NullableImageChecksum{value: val, isSet: true} +} + +func (v NullableImageChecksum) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageChecksum) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_config.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_config.go new file mode 100644 index 00000000..9e4aca23 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_config.go @@ -0,0 +1,882 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageConfig{} + +/* + types and functions for architecture +*/ + +// isNotNullableString +type ImageConfigGetArchitectureAttributeType = *string + +func getImageConfigGetArchitectureAttributeTypeOk(arg ImageConfigGetArchitectureAttributeType) (ret ImageConfigGetArchitectureRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfigGetArchitectureAttributeType(arg *ImageConfigGetArchitectureAttributeType, val ImageConfigGetArchitectureRetType) { + *arg = &val +} + +type ImageConfigGetArchitectureArgType = string +type ImageConfigGetArchitectureRetType = string + +/* + types and functions for bootMenu +*/ + +// isBoolean +type ImageConfiggetBootMenuAttributeType = *bool +type ImageConfiggetBootMenuArgType = bool +type ImageConfiggetBootMenuRetType = bool + +func getImageConfiggetBootMenuAttributeTypeOk(arg ImageConfiggetBootMenuAttributeType) (ret ImageConfiggetBootMenuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetBootMenuAttributeType(arg *ImageConfiggetBootMenuAttributeType, val ImageConfiggetBootMenuRetType) { + *arg = &val +} + +/* + types and functions for cdromBus +*/ + +// isNullableString +type ImageConfigGetCdromBusAttributeType = *NullableString + +func getImageConfigGetCdromBusAttributeTypeOk(arg ImageConfigGetCdromBusAttributeType) (ret ImageConfigGetCdromBusRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetCdromBusAttributeType(arg *ImageConfigGetCdromBusAttributeType, val ImageConfigGetCdromBusRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetCdromBusArgType = *string +type ImageConfigGetCdromBusRetType = *string + +/* + types and functions for diskBus +*/ + +// isNullableString +type ImageConfigGetDiskBusAttributeType = *NullableString + +func getImageConfigGetDiskBusAttributeTypeOk(arg ImageConfigGetDiskBusAttributeType) (ret ImageConfigGetDiskBusRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetDiskBusAttributeType(arg *ImageConfigGetDiskBusAttributeType, val ImageConfigGetDiskBusRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetDiskBusArgType = *string +type ImageConfigGetDiskBusRetType = *string + +/* + types and functions for nicModel +*/ + +// isNullableString +type ImageConfigGetNicModelAttributeType = *NullableString + +func getImageConfigGetNicModelAttributeTypeOk(arg ImageConfigGetNicModelAttributeType) (ret ImageConfigGetNicModelRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetNicModelAttributeType(arg *ImageConfigGetNicModelAttributeType, val ImageConfigGetNicModelRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetNicModelArgType = *string +type ImageConfigGetNicModelRetType = *string + +/* + types and functions for operatingSystem +*/ + +// isNotNullableString +type ImageConfigGetOperatingSystemAttributeType = *string + +func getImageConfigGetOperatingSystemAttributeTypeOk(arg ImageConfigGetOperatingSystemAttributeType) (ret ImageConfigGetOperatingSystemRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfigGetOperatingSystemAttributeType(arg *ImageConfigGetOperatingSystemAttributeType, val ImageConfigGetOperatingSystemRetType) { + *arg = &val +} + +type ImageConfigGetOperatingSystemArgType = string +type ImageConfigGetOperatingSystemRetType = string + +/* + types and functions for operatingSystemDistro +*/ + +// isNullableString +type ImageConfigGetOperatingSystemDistroAttributeType = *NullableString + +func getImageConfigGetOperatingSystemDistroAttributeTypeOk(arg ImageConfigGetOperatingSystemDistroAttributeType) (ret ImageConfigGetOperatingSystemDistroRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetOperatingSystemDistroAttributeType(arg *ImageConfigGetOperatingSystemDistroAttributeType, val ImageConfigGetOperatingSystemDistroRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetOperatingSystemDistroArgType = *string +type ImageConfigGetOperatingSystemDistroRetType = *string + +/* + types and functions for operatingSystemVersion +*/ + +// isNullableString +type ImageConfigGetOperatingSystemVersionAttributeType = *NullableString + +func getImageConfigGetOperatingSystemVersionAttributeTypeOk(arg ImageConfigGetOperatingSystemVersionAttributeType) (ret ImageConfigGetOperatingSystemVersionRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetOperatingSystemVersionAttributeType(arg *ImageConfigGetOperatingSystemVersionAttributeType, val ImageConfigGetOperatingSystemVersionRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetOperatingSystemVersionArgType = *string +type ImageConfigGetOperatingSystemVersionRetType = *string + +/* + types and functions for rescueBus +*/ + +// isNullableString +type ImageConfigGetRescueBusAttributeType = *NullableString + +func getImageConfigGetRescueBusAttributeTypeOk(arg ImageConfigGetRescueBusAttributeType) (ret ImageConfigGetRescueBusRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetRescueBusAttributeType(arg *ImageConfigGetRescueBusAttributeType, val ImageConfigGetRescueBusRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetRescueBusArgType = *string +type ImageConfigGetRescueBusRetType = *string + +/* + types and functions for rescueDevice +*/ + +// isNullableString +type ImageConfigGetRescueDeviceAttributeType = *NullableString + +func getImageConfigGetRescueDeviceAttributeTypeOk(arg ImageConfigGetRescueDeviceAttributeType) (ret ImageConfigGetRescueDeviceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetRescueDeviceAttributeType(arg *ImageConfigGetRescueDeviceAttributeType, val ImageConfigGetRescueDeviceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetRescueDeviceArgType = *string +type ImageConfigGetRescueDeviceRetType = *string + +/* + types and functions for secureBoot +*/ + +// isBoolean +type ImageConfiggetSecureBootAttributeType = *bool +type ImageConfiggetSecureBootArgType = bool +type ImageConfiggetSecureBootRetType = bool + +func getImageConfiggetSecureBootAttributeTypeOk(arg ImageConfiggetSecureBootAttributeType) (ret ImageConfiggetSecureBootRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetSecureBootAttributeType(arg *ImageConfiggetSecureBootAttributeType, val ImageConfiggetSecureBootRetType) { + *arg = &val +} + +/* + types and functions for uefi +*/ + +// isBoolean +type ImageConfiggetUefiAttributeType = *bool +type ImageConfiggetUefiArgType = bool +type ImageConfiggetUefiRetType = bool + +func getImageConfiggetUefiAttributeTypeOk(arg ImageConfiggetUefiAttributeType) (ret ImageConfiggetUefiRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetUefiAttributeType(arg *ImageConfiggetUefiAttributeType, val ImageConfiggetUefiRetType) { + *arg = &val +} + +/* + types and functions for videoModel +*/ + +// isNullableString +type ImageConfigGetVideoModelAttributeType = *NullableString + +func getImageConfigGetVideoModelAttributeTypeOk(arg ImageConfigGetVideoModelAttributeType) (ret ImageConfigGetVideoModelRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setImageConfigGetVideoModelAttributeType(arg *ImageConfigGetVideoModelAttributeType, val ImageConfigGetVideoModelRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type ImageConfigGetVideoModelArgType = *string +type ImageConfigGetVideoModelRetType = *string + +/* + types and functions for virtioScsi +*/ + +// isBoolean +type ImageConfiggetVirtioScsiAttributeType = *bool +type ImageConfiggetVirtioScsiArgType = bool +type ImageConfiggetVirtioScsiRetType = bool + +func getImageConfiggetVirtioScsiAttributeTypeOk(arg ImageConfiggetVirtioScsiAttributeType) (ret ImageConfiggetVirtioScsiRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageConfiggetVirtioScsiAttributeType(arg *ImageConfiggetVirtioScsiAttributeType, val ImageConfiggetVirtioScsiRetType) { + *arg = &val +} + +// ImageConfig Properties to set hardware and scheduling settings for an Image. +type ImageConfig struct { + // Represents CPU architecture. The default for new images is x86. Possible values: `arm64`, `x86`. + Architecture ImageConfigGetArchitectureAttributeType `json:"architecture,omitempty"` + // Enables the BIOS bootmenu. The default for new images is disabled. + BootMenu ImageConfiggetBootMenuAttributeType `json:"bootMenu,omitempty"` + // Sets CDROM bus controller type. Possible values: `scsi`, `virtio`, `ide`, `usb`. + CdromBus ImageConfigGetCdromBusAttributeType `json:"cdromBus,omitempty"` + // Sets Disk bus controller type. Possible values: `scsi`, `virtio`, `ide`, `usb`. + DiskBus ImageConfigGetDiskBusAttributeType `json:"diskBus,omitempty"` + // Sets virtual nic model. Possible values: `e1000`, `e1000e`, `ne2k_pci`, `pcnet`, `rtl8139`, `virtio`, `vmxnet3`. + NicModel ImageConfigGetNicModelAttributeType `json:"nicModel,omitempty"` + // Enables OS specific optimizations. Possible values: `windows`, `linux`. + OperatingSystem ImageConfigGetOperatingSystemAttributeType `json:"operatingSystem,omitempty"` + // Operating System Distribution. + OperatingSystemDistro ImageConfigGetOperatingSystemDistroAttributeType `json:"operatingSystemDistro,omitempty"` + // Version of the OS. + OperatingSystemVersion ImageConfigGetOperatingSystemVersionAttributeType `json:"operatingSystemVersion,omitempty"` + // Sets the device bus when the image is used as a rescue image. Possible values: `sata`, `scsi`, `virtio`, `usb`. + RescueBus ImageConfigGetRescueBusAttributeType `json:"rescueBus,omitempty"` + // Sets the device when the image is used as a rescue image. Possible values: `cdrom`, `disk`. + RescueDevice ImageConfigGetRescueDeviceAttributeType `json:"rescueDevice,omitempty"` + // Enables Secure Boot. The default for new images is disabled. + SecureBoot ImageConfiggetSecureBootAttributeType `json:"secureBoot,omitempty"` + // Configure UEFI boot. The default for new images is enabled. + Uefi ImageConfiggetUefiAttributeType `json:"uefi,omitempty"` + // Sets Graphic device model. Possible values: `vga`, `cirrus`, `vmvga`, `qxl`, `virtio`, `none`. + VideoModel ImageConfigGetVideoModelAttributeType `json:"videoModel,omitempty"` + // Enables the use of VirtIO SCSI to provide block device access. By default servers use VirtIO Block. + VirtioScsi ImageConfiggetVirtioScsiAttributeType `json:"virtioScsi,omitempty"` +} + +// NewImageConfig instantiates a new ImageConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageConfig() *ImageConfig { + this := ImageConfig{} + return &this +} + +// NewImageConfigWithDefaults instantiates a new ImageConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageConfigWithDefaults() *ImageConfig { + this := ImageConfig{} + return &this +} + +// GetArchitecture returns the Architecture field value if set, zero value otherwise. +func (o *ImageConfig) GetArchitecture() (res ImageConfigGetArchitectureRetType) { + res, _ = o.GetArchitectureOk() + return +} + +// GetArchitectureOk returns a tuple with the Architecture field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetArchitectureOk() (ret ImageConfigGetArchitectureRetType, ok bool) { + return getImageConfigGetArchitectureAttributeTypeOk(o.Architecture) +} + +// HasArchitecture returns a boolean if a field has been set. +func (o *ImageConfig) HasArchitecture() bool { + _, ok := o.GetArchitectureOk() + return ok +} + +// SetArchitecture gets a reference to the given string and assigns it to the Architecture field. +func (o *ImageConfig) SetArchitecture(v ImageConfigGetArchitectureRetType) { + setImageConfigGetArchitectureAttributeType(&o.Architecture, v) +} + +// GetBootMenu returns the BootMenu field value if set, zero value otherwise. +func (o *ImageConfig) GetBootMenu() (res ImageConfiggetBootMenuRetType) { + res, _ = o.GetBootMenuOk() + return +} + +// GetBootMenuOk returns a tuple with the BootMenu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetBootMenuOk() (ret ImageConfiggetBootMenuRetType, ok bool) { + return getImageConfiggetBootMenuAttributeTypeOk(o.BootMenu) +} + +// HasBootMenu returns a boolean if a field has been set. +func (o *ImageConfig) HasBootMenu() bool { + _, ok := o.GetBootMenuOk() + return ok +} + +// SetBootMenu gets a reference to the given bool and assigns it to the BootMenu field. +func (o *ImageConfig) SetBootMenu(v ImageConfiggetBootMenuRetType) { + setImageConfiggetBootMenuAttributeType(&o.BootMenu, v) +} + +// GetCdromBus returns the CdromBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetCdromBus() (res ImageConfigGetCdromBusRetType) { + res, _ = o.GetCdromBusOk() + return +} + +// GetCdromBusOk returns a tuple with the CdromBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetCdromBusOk() (ret ImageConfigGetCdromBusRetType, ok bool) { + return getImageConfigGetCdromBusAttributeTypeOk(o.CdromBus) +} + +// HasCdromBus returns a boolean if a field has been set. +func (o *ImageConfig) HasCdromBus() bool { + _, ok := o.GetCdromBusOk() + return ok +} + +// SetCdromBus gets a reference to the given string and assigns it to the CdromBus field. +func (o *ImageConfig) SetCdromBus(v ImageConfigGetCdromBusRetType) { + setImageConfigGetCdromBusAttributeType(&o.CdromBus, v) +} + +// SetCdromBusNil sets the value for CdromBus to be an explicit nil +func (o *ImageConfig) SetCdromBusNil() { + o.CdromBus = nil +} + +// UnsetCdromBus ensures that no value is present for CdromBus, not even an explicit nil +func (o *ImageConfig) UnsetCdromBus() { + o.CdromBus = nil +} + +// GetDiskBus returns the DiskBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetDiskBus() (res ImageConfigGetDiskBusRetType) { + res, _ = o.GetDiskBusOk() + return +} + +// GetDiskBusOk returns a tuple with the DiskBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetDiskBusOk() (ret ImageConfigGetDiskBusRetType, ok bool) { + return getImageConfigGetDiskBusAttributeTypeOk(o.DiskBus) +} + +// HasDiskBus returns a boolean if a field has been set. +func (o *ImageConfig) HasDiskBus() bool { + _, ok := o.GetDiskBusOk() + return ok +} + +// SetDiskBus gets a reference to the given string and assigns it to the DiskBus field. +func (o *ImageConfig) SetDiskBus(v ImageConfigGetDiskBusRetType) { + setImageConfigGetDiskBusAttributeType(&o.DiskBus, v) +} + +// SetDiskBusNil sets the value for DiskBus to be an explicit nil +func (o *ImageConfig) SetDiskBusNil() { + o.DiskBus = nil +} + +// UnsetDiskBus ensures that no value is present for DiskBus, not even an explicit nil +func (o *ImageConfig) UnsetDiskBus() { + o.DiskBus = nil +} + +// GetNicModel returns the NicModel field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetNicModel() (res ImageConfigGetNicModelRetType) { + res, _ = o.GetNicModelOk() + return +} + +// GetNicModelOk returns a tuple with the NicModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetNicModelOk() (ret ImageConfigGetNicModelRetType, ok bool) { + return getImageConfigGetNicModelAttributeTypeOk(o.NicModel) +} + +// HasNicModel returns a boolean if a field has been set. +func (o *ImageConfig) HasNicModel() bool { + _, ok := o.GetNicModelOk() + return ok +} + +// SetNicModel gets a reference to the given string and assigns it to the NicModel field. +func (o *ImageConfig) SetNicModel(v ImageConfigGetNicModelRetType) { + setImageConfigGetNicModelAttributeType(&o.NicModel, v) +} + +// SetNicModelNil sets the value for NicModel to be an explicit nil +func (o *ImageConfig) SetNicModelNil() { + o.NicModel = nil +} + +// UnsetNicModel ensures that no value is present for NicModel, not even an explicit nil +func (o *ImageConfig) UnsetNicModel() { + o.NicModel = nil +} + +// GetOperatingSystem returns the OperatingSystem field value if set, zero value otherwise. +func (o *ImageConfig) GetOperatingSystem() (res ImageConfigGetOperatingSystemRetType) { + res, _ = o.GetOperatingSystemOk() + return +} + +// GetOperatingSystemOk returns a tuple with the OperatingSystem field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetOperatingSystemOk() (ret ImageConfigGetOperatingSystemRetType, ok bool) { + return getImageConfigGetOperatingSystemAttributeTypeOk(o.OperatingSystem) +} + +// HasOperatingSystem returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystem() bool { + _, ok := o.GetOperatingSystemOk() + return ok +} + +// SetOperatingSystem gets a reference to the given string and assigns it to the OperatingSystem field. +func (o *ImageConfig) SetOperatingSystem(v ImageConfigGetOperatingSystemRetType) { + setImageConfigGetOperatingSystemAttributeType(&o.OperatingSystem, v) +} + +// GetOperatingSystemDistro returns the OperatingSystemDistro field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetOperatingSystemDistro() (res ImageConfigGetOperatingSystemDistroRetType) { + res, _ = o.GetOperatingSystemDistroOk() + return +} + +// GetOperatingSystemDistroOk returns a tuple with the OperatingSystemDistro field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemDistroOk() (ret ImageConfigGetOperatingSystemDistroRetType, ok bool) { + return getImageConfigGetOperatingSystemDistroAttributeTypeOk(o.OperatingSystemDistro) +} + +// HasOperatingSystemDistro returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemDistro() bool { + _, ok := o.GetOperatingSystemDistroOk() + return ok +} + +// SetOperatingSystemDistro gets a reference to the given string and assigns it to the OperatingSystemDistro field. +func (o *ImageConfig) SetOperatingSystemDistro(v ImageConfigGetOperatingSystemDistroRetType) { + setImageConfigGetOperatingSystemDistroAttributeType(&o.OperatingSystemDistro, v) +} + +// SetOperatingSystemDistroNil sets the value for OperatingSystemDistro to be an explicit nil +func (o *ImageConfig) SetOperatingSystemDistroNil() { + o.OperatingSystemDistro = nil +} + +// UnsetOperatingSystemDistro ensures that no value is present for OperatingSystemDistro, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemDistro() { + o.OperatingSystemDistro = nil +} + +// GetOperatingSystemVersion returns the OperatingSystemVersion field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetOperatingSystemVersion() (res ImageConfigGetOperatingSystemVersionRetType) { + res, _ = o.GetOperatingSystemVersionOk() + return +} + +// GetOperatingSystemVersionOk returns a tuple with the OperatingSystemVersion field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetOperatingSystemVersionOk() (ret ImageConfigGetOperatingSystemVersionRetType, ok bool) { + return getImageConfigGetOperatingSystemVersionAttributeTypeOk(o.OperatingSystemVersion) +} + +// HasOperatingSystemVersion returns a boolean if a field has been set. +func (o *ImageConfig) HasOperatingSystemVersion() bool { + _, ok := o.GetOperatingSystemVersionOk() + return ok +} + +// SetOperatingSystemVersion gets a reference to the given string and assigns it to the OperatingSystemVersion field. +func (o *ImageConfig) SetOperatingSystemVersion(v ImageConfigGetOperatingSystemVersionRetType) { + setImageConfigGetOperatingSystemVersionAttributeType(&o.OperatingSystemVersion, v) +} + +// SetOperatingSystemVersionNil sets the value for OperatingSystemVersion to be an explicit nil +func (o *ImageConfig) SetOperatingSystemVersionNil() { + o.OperatingSystemVersion = nil +} + +// UnsetOperatingSystemVersion ensures that no value is present for OperatingSystemVersion, not even an explicit nil +func (o *ImageConfig) UnsetOperatingSystemVersion() { + o.OperatingSystemVersion = nil +} + +// GetRescueBus returns the RescueBus field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetRescueBus() (res ImageConfigGetRescueBusRetType) { + res, _ = o.GetRescueBusOk() + return +} + +// GetRescueBusOk returns a tuple with the RescueBus field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueBusOk() (ret ImageConfigGetRescueBusRetType, ok bool) { + return getImageConfigGetRescueBusAttributeTypeOk(o.RescueBus) +} + +// HasRescueBus returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueBus() bool { + _, ok := o.GetRescueBusOk() + return ok +} + +// SetRescueBus gets a reference to the given string and assigns it to the RescueBus field. +func (o *ImageConfig) SetRescueBus(v ImageConfigGetRescueBusRetType) { + setImageConfigGetRescueBusAttributeType(&o.RescueBus, v) +} + +// SetRescueBusNil sets the value for RescueBus to be an explicit nil +func (o *ImageConfig) SetRescueBusNil() { + o.RescueBus = nil +} + +// UnsetRescueBus ensures that no value is present for RescueBus, not even an explicit nil +func (o *ImageConfig) UnsetRescueBus() { + o.RescueBus = nil +} + +// GetRescueDevice returns the RescueDevice field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetRescueDevice() (res ImageConfigGetRescueDeviceRetType) { + res, _ = o.GetRescueDeviceOk() + return +} + +// GetRescueDeviceOk returns a tuple with the RescueDevice field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetRescueDeviceOk() (ret ImageConfigGetRescueDeviceRetType, ok bool) { + return getImageConfigGetRescueDeviceAttributeTypeOk(o.RescueDevice) +} + +// HasRescueDevice returns a boolean if a field has been set. +func (o *ImageConfig) HasRescueDevice() bool { + _, ok := o.GetRescueDeviceOk() + return ok +} + +// SetRescueDevice gets a reference to the given string and assigns it to the RescueDevice field. +func (o *ImageConfig) SetRescueDevice(v ImageConfigGetRescueDeviceRetType) { + setImageConfigGetRescueDeviceAttributeType(&o.RescueDevice, v) +} + +// SetRescueDeviceNil sets the value for RescueDevice to be an explicit nil +func (o *ImageConfig) SetRescueDeviceNil() { + o.RescueDevice = nil +} + +// UnsetRescueDevice ensures that no value is present for RescueDevice, not even an explicit nil +func (o *ImageConfig) UnsetRescueDevice() { + o.RescueDevice = nil +} + +// GetSecureBoot returns the SecureBoot field value if set, zero value otherwise. +func (o *ImageConfig) GetSecureBoot() (res ImageConfiggetSecureBootRetType) { + res, _ = o.GetSecureBootOk() + return +} + +// GetSecureBootOk returns a tuple with the SecureBoot field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetSecureBootOk() (ret ImageConfiggetSecureBootRetType, ok bool) { + return getImageConfiggetSecureBootAttributeTypeOk(o.SecureBoot) +} + +// HasSecureBoot returns a boolean if a field has been set. +func (o *ImageConfig) HasSecureBoot() bool { + _, ok := o.GetSecureBootOk() + return ok +} + +// SetSecureBoot gets a reference to the given bool and assigns it to the SecureBoot field. +func (o *ImageConfig) SetSecureBoot(v ImageConfiggetSecureBootRetType) { + setImageConfiggetSecureBootAttributeType(&o.SecureBoot, v) +} + +// GetUefi returns the Uefi field value if set, zero value otherwise. +func (o *ImageConfig) GetUefi() (res ImageConfiggetUefiRetType) { + res, _ = o.GetUefiOk() + return +} + +// GetUefiOk returns a tuple with the Uefi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetUefiOk() (ret ImageConfiggetUefiRetType, ok bool) { + return getImageConfiggetUefiAttributeTypeOk(o.Uefi) +} + +// HasUefi returns a boolean if a field has been set. +func (o *ImageConfig) HasUefi() bool { + _, ok := o.GetUefiOk() + return ok +} + +// SetUefi gets a reference to the given bool and assigns it to the Uefi field. +func (o *ImageConfig) SetUefi(v ImageConfiggetUefiRetType) { + setImageConfiggetUefiAttributeType(&o.Uefi, v) +} + +// GetVideoModel returns the VideoModel field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ImageConfig) GetVideoModel() (res ImageConfigGetVideoModelRetType) { + res, _ = o.GetVideoModelOk() + return +} + +// GetVideoModelOk returns a tuple with the VideoModel field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ImageConfig) GetVideoModelOk() (ret ImageConfigGetVideoModelRetType, ok bool) { + return getImageConfigGetVideoModelAttributeTypeOk(o.VideoModel) +} + +// HasVideoModel returns a boolean if a field has been set. +func (o *ImageConfig) HasVideoModel() bool { + _, ok := o.GetVideoModelOk() + return ok +} + +// SetVideoModel gets a reference to the given string and assigns it to the VideoModel field. +func (o *ImageConfig) SetVideoModel(v ImageConfigGetVideoModelRetType) { + setImageConfigGetVideoModelAttributeType(&o.VideoModel, v) +} + +// SetVideoModelNil sets the value for VideoModel to be an explicit nil +func (o *ImageConfig) SetVideoModelNil() { + o.VideoModel = nil +} + +// UnsetVideoModel ensures that no value is present for VideoModel, not even an explicit nil +func (o *ImageConfig) UnsetVideoModel() { + o.VideoModel = nil +} + +// GetVirtioScsi returns the VirtioScsi field value if set, zero value otherwise. +func (o *ImageConfig) GetVirtioScsi() (res ImageConfiggetVirtioScsiRetType) { + res, _ = o.GetVirtioScsiOk() + return +} + +// GetVirtioScsiOk returns a tuple with the VirtioScsi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetVirtioScsiOk() (ret ImageConfiggetVirtioScsiRetType, ok bool) { + return getImageConfiggetVirtioScsiAttributeTypeOk(o.VirtioScsi) +} + +// HasVirtioScsi returns a boolean if a field has been set. +func (o *ImageConfig) HasVirtioScsi() bool { + _, ok := o.GetVirtioScsiOk() + return ok +} + +// SetVirtioScsi gets a reference to the given bool and assigns it to the VirtioScsi field. +func (o *ImageConfig) SetVirtioScsi(v ImageConfiggetVirtioScsiRetType) { + setImageConfiggetVirtioScsiAttributeType(&o.VirtioScsi, v) +} + +func (o ImageConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageConfigGetArchitectureAttributeTypeOk(o.Architecture); ok { + toSerialize["Architecture"] = val + } + if val, ok := getImageConfiggetBootMenuAttributeTypeOk(o.BootMenu); ok { + toSerialize["BootMenu"] = val + } + if val, ok := getImageConfigGetCdromBusAttributeTypeOk(o.CdromBus); ok { + toSerialize["CdromBus"] = val + } + if val, ok := getImageConfigGetDiskBusAttributeTypeOk(o.DiskBus); ok { + toSerialize["DiskBus"] = val + } + if val, ok := getImageConfigGetNicModelAttributeTypeOk(o.NicModel); ok { + toSerialize["NicModel"] = val + } + if val, ok := getImageConfigGetOperatingSystemAttributeTypeOk(o.OperatingSystem); ok { + toSerialize["OperatingSystem"] = val + } + if val, ok := getImageConfigGetOperatingSystemDistroAttributeTypeOk(o.OperatingSystemDistro); ok { + toSerialize["OperatingSystemDistro"] = val + } + if val, ok := getImageConfigGetOperatingSystemVersionAttributeTypeOk(o.OperatingSystemVersion); ok { + toSerialize["OperatingSystemVersion"] = val + } + if val, ok := getImageConfigGetRescueBusAttributeTypeOk(o.RescueBus); ok { + toSerialize["RescueBus"] = val + } + if val, ok := getImageConfigGetRescueDeviceAttributeTypeOk(o.RescueDevice); ok { + toSerialize["RescueDevice"] = val + } + if val, ok := getImageConfiggetSecureBootAttributeTypeOk(o.SecureBoot); ok { + toSerialize["SecureBoot"] = val + } + if val, ok := getImageConfiggetUefiAttributeTypeOk(o.Uefi); ok { + toSerialize["Uefi"] = val + } + if val, ok := getImageConfigGetVideoModelAttributeTypeOk(o.VideoModel); ok { + toSerialize["VideoModel"] = val + } + if val, ok := getImageConfiggetVirtioScsiAttributeTypeOk(o.VirtioScsi); ok { + toSerialize["VirtioScsi"] = val + } + return toSerialize, nil +} + +type NullableImageConfig struct { + value *ImageConfig + isSet bool +} + +func (v NullableImageConfig) Get() *ImageConfig { + return v.value +} + +func (v *NullableImageConfig) Set(val *ImageConfig) { + v.value = val + v.isSet = true +} + +func (v NullableImageConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableImageConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageConfig(val *ImageConfig) *NullableImageConfig { + return &NullableImageConfig{value: val, isSet: true} +} + +func (v NullableImageConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_create_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_create_response.go new file mode 100644 index 00000000..066c9522 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_create_response.go @@ -0,0 +1,171 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageCreateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageCreateResponse{} + +/* + types and functions for id +*/ + +// isNotNullableString +type ImageCreateResponseGetIdAttributeType = *string + +func getImageCreateResponseGetIdAttributeTypeOk(arg ImageCreateResponseGetIdAttributeType) (ret ImageCreateResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageCreateResponseGetIdAttributeType(arg *ImageCreateResponseGetIdAttributeType, val ImageCreateResponseGetIdRetType) { + *arg = &val +} + +type ImageCreateResponseGetIdArgType = string +type ImageCreateResponseGetIdRetType = string + +/* + types and functions for uploadUrl +*/ + +// isNotNullableString +type ImageCreateResponseGetUploadUrlAttributeType = *string + +func getImageCreateResponseGetUploadUrlAttributeTypeOk(arg ImageCreateResponseGetUploadUrlAttributeType) (ret ImageCreateResponseGetUploadUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageCreateResponseGetUploadUrlAttributeType(arg *ImageCreateResponseGetUploadUrlAttributeType, val ImageCreateResponseGetUploadUrlRetType) { + *arg = &val +} + +type ImageCreateResponseGetUploadUrlArgType = string +type ImageCreateResponseGetUploadUrlRetType = string + +// ImageCreateResponse Image creation response. +type ImageCreateResponse struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id ImageCreateResponseGetIdAttributeType `json:"id" required:"true"` + // REQUIRED + UploadUrl ImageCreateResponseGetUploadUrlAttributeType `json:"uploadUrl" required:"true"` +} + +type _ImageCreateResponse ImageCreateResponse + +// NewImageCreateResponse instantiates a new ImageCreateResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageCreateResponse(id ImageCreateResponseGetIdArgType, uploadUrl ImageCreateResponseGetUploadUrlArgType) *ImageCreateResponse { + this := ImageCreateResponse{} + setImageCreateResponseGetIdAttributeType(&this.Id, id) + setImageCreateResponseGetUploadUrlAttributeType(&this.UploadUrl, uploadUrl) + return &this +} + +// NewImageCreateResponseWithDefaults instantiates a new ImageCreateResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageCreateResponseWithDefaults() *ImageCreateResponse { + this := ImageCreateResponse{} + return &this +} + +// GetId returns the Id field value +func (o *ImageCreateResponse) GetId() (ret ImageCreateResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetIdOk() (ret ImageCreateResponseGetIdRetType, ok bool) { + return getImageCreateResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *ImageCreateResponse) SetId(v ImageCreateResponseGetIdRetType) { + setImageCreateResponseGetIdAttributeType(&o.Id, v) +} + +// GetUploadUrl returns the UploadUrl field value +func (o *ImageCreateResponse) GetUploadUrl() (ret ImageCreateResponseGetUploadUrlRetType) { + ret, _ = o.GetUploadUrlOk() + return ret +} + +// GetUploadUrlOk returns a tuple with the UploadUrl field value +// and a boolean to check if the value has been set. +func (o *ImageCreateResponse) GetUploadUrlOk() (ret ImageCreateResponseGetUploadUrlRetType, ok bool) { + return getImageCreateResponseGetUploadUrlAttributeTypeOk(o.UploadUrl) +} + +// SetUploadUrl sets field value +func (o *ImageCreateResponse) SetUploadUrl(v ImageCreateResponseGetUploadUrlRetType) { + setImageCreateResponseGetUploadUrlAttributeType(&o.UploadUrl, v) +} + +func (o ImageCreateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageCreateResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getImageCreateResponseGetUploadUrlAttributeTypeOk(o.UploadUrl); ok { + toSerialize["UploadUrl"] = val + } + return toSerialize, nil +} + +type NullableImageCreateResponse struct { + value *ImageCreateResponse + isSet bool +} + +func (v NullableImageCreateResponse) Get() *ImageCreateResponse { + return v.value +} + +func (v *NullableImageCreateResponse) Set(val *ImageCreateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageCreateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageCreateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageCreateResponse(val *ImageCreateResponse) *NullableImageCreateResponse { + return &NullableImageCreateResponse{value: val, isSet: true} +} + +func (v NullableImageCreateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageCreateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_list_response.go new file mode 100644 index 00000000..b00b3cbe --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ImageListResponseGetItemsAttributeType = *[]Image +type ImageListResponseGetItemsArgType = []Image +type ImageListResponseGetItemsRetType = []Image + +func getImageListResponseGetItemsAttributeTypeOk(arg ImageListResponseGetItemsAttributeType) (ret ImageListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageListResponseGetItemsAttributeType(arg *ImageListResponseGetItemsAttributeType, val ImageListResponseGetItemsRetType) { + *arg = &val +} + +// ImageListResponse Image list response. +type ImageListResponse struct { + // A list containing image objects. + // REQUIRED + Items ImageListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ImageListResponse ImageListResponse + +// NewImageListResponse instantiates a new ImageListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageListResponse(items ImageListResponseGetItemsArgType) *ImageListResponse { + this := ImageListResponse{} + setImageListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewImageListResponseWithDefaults instantiates a new ImageListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageListResponseWithDefaults() *ImageListResponse { + this := ImageListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ImageListResponse) GetItems() (ret ImageListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ImageListResponse) GetItemsOk() (ret ImageListResponseGetItemsRetType, ok bool) { + return getImageListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ImageListResponse) SetItems(v ImageListResponseGetItemsRetType) { + setImageListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ImageListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableImageListResponse struct { + value *ImageListResponse + isSet bool +} + +func (v NullableImageListResponse) Get() *ImageListResponse { + return v.value +} + +func (v *NullableImageListResponse) Set(val *ImageListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableImageListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableImageListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageListResponse(val *ImageListResponse) *NullableImageListResponse { + return &NullableImageListResponse{value: val, isSet: true} +} + +func (v NullableImageListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_share.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_share.go new file mode 100644 index 00000000..5a0cee26 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_share.go @@ -0,0 +1,176 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ImageShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageShare{} + +/* + types and functions for parentOrganization +*/ + +// isBoolean +type ImageSharegetParentOrganizationAttributeType = *bool +type ImageSharegetParentOrganizationArgType = bool +type ImageSharegetParentOrganizationRetType = bool + +func getImageSharegetParentOrganizationAttributeTypeOk(arg ImageSharegetParentOrganizationAttributeType) (ret ImageSharegetParentOrganizationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageSharegetParentOrganizationAttributeType(arg *ImageSharegetParentOrganizationAttributeType, val ImageSharegetParentOrganizationRetType) { + *arg = &val +} + +/* + types and functions for projects +*/ + +// isArray +type ImageShareGetProjectsAttributeType = *[]string +type ImageShareGetProjectsArgType = []string +type ImageShareGetProjectsRetType = []string + +func getImageShareGetProjectsAttributeTypeOk(arg ImageShareGetProjectsAttributeType) (ret ImageShareGetProjectsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareGetProjectsAttributeType(arg *ImageShareGetProjectsAttributeType, val ImageShareGetProjectsRetType) { + *arg = &val +} + +// ImageShare Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type ImageShare struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization ImageSharegetParentOrganizationAttributeType `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects ImageShareGetProjectsAttributeType `json:"projects,omitempty"` +} + +// NewImageShare instantiates a new ImageShare object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageShare() *ImageShare { + this := ImageShare{} + return &this +} + +// NewImageShareWithDefaults instantiates a new ImageShare object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageShareWithDefaults() *ImageShare { + this := ImageShare{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *ImageShare) GetParentOrganization() (res ImageSharegetParentOrganizationRetType) { + res, _ = o.GetParentOrganizationOk() + return +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShare) GetParentOrganizationOk() (ret ImageSharegetParentOrganizationRetType, ok bool) { + return getImageSharegetParentOrganizationAttributeTypeOk(o.ParentOrganization) +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *ImageShare) HasParentOrganization() bool { + _, ok := o.GetParentOrganizationOk() + return ok +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *ImageShare) SetParentOrganization(v ImageSharegetParentOrganizationRetType) { + setImageSharegetParentOrganizationAttributeType(&o.ParentOrganization, v) +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *ImageShare) GetProjects() (res ImageShareGetProjectsRetType) { + res, _ = o.GetProjectsOk() + return +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShare) GetProjectsOk() (ret ImageShareGetProjectsRetType, ok bool) { + return getImageShareGetProjectsAttributeTypeOk(o.Projects) +} + +// HasProjects returns a boolean if a field has been set. +func (o *ImageShare) HasProjects() bool { + _, ok := o.GetProjectsOk() + return ok +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *ImageShare) SetProjects(v ImageShareGetProjectsRetType) { + setImageShareGetProjectsAttributeType(&o.Projects, v) +} + +func (o ImageShare) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageSharegetParentOrganizationAttributeTypeOk(o.ParentOrganization); ok { + toSerialize["ParentOrganization"] = val + } + if val, ok := getImageShareGetProjectsAttributeTypeOk(o.Projects); ok { + toSerialize["Projects"] = val + } + return toSerialize, nil +} + +type NullableImageShare struct { + value *ImageShare + isSet bool +} + +func (v NullableImageShare) Get() *ImageShare { + return v.value +} + +func (v *NullableImageShare) Set(val *ImageShare) { + v.value = val + v.isSet = true +} + +func (v NullableImageShare) IsSet() bool { + return v.isSet +} + +func (v *NullableImageShare) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageShare(val *ImageShare) *NullableImageShare { + return &NullableImageShare{value: val, isSet: true} +} + +func (v NullableImageShare) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageShare) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_share_consumer.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_share_consumer.go new file mode 100644 index 00000000..a88b88ad --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_image_share_consumer.go @@ -0,0 +1,275 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the ImageShareConsumer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageShareConsumer{} + +/* + types and functions for consumerProjectId +*/ + +// isNotNullableString +type ImageShareConsumerGetConsumerProjectIdAttributeType = *string + +func getImageShareConsumerGetConsumerProjectIdAttributeTypeOk(arg ImageShareConsumerGetConsumerProjectIdAttributeType) (ret ImageShareConsumerGetConsumerProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetConsumerProjectIdAttributeType(arg *ImageShareConsumerGetConsumerProjectIdAttributeType, val ImageShareConsumerGetConsumerProjectIdRetType) { + *arg = &val +} + +type ImageShareConsumerGetConsumerProjectIdArgType = string +type ImageShareConsumerGetConsumerProjectIdRetType = string + +/* + types and functions for createdAt +*/ + +// isDateTime +type ImageShareConsumerGetCreatedAtAttributeType = *time.Time +type ImageShareConsumerGetCreatedAtArgType = time.Time +type ImageShareConsumerGetCreatedAtRetType = time.Time + +func getImageShareConsumerGetCreatedAtAttributeTypeOk(arg ImageShareConsumerGetCreatedAtAttributeType) (ret ImageShareConsumerGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetCreatedAtAttributeType(arg *ImageShareConsumerGetCreatedAtAttributeType, val ImageShareConsumerGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for imageId +*/ + +// isNotNullableString +type ImageShareConsumerGetImageIdAttributeType = *string + +func getImageShareConsumerGetImageIdAttributeTypeOk(arg ImageShareConsumerGetImageIdAttributeType) (ret ImageShareConsumerGetImageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetImageIdAttributeType(arg *ImageShareConsumerGetImageIdAttributeType, val ImageShareConsumerGetImageIdRetType) { + *arg = &val +} + +type ImageShareConsumerGetImageIdArgType = string +type ImageShareConsumerGetImageIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ImageShareConsumerGetUpdatedAtAttributeType = *time.Time +type ImageShareConsumerGetUpdatedAtArgType = time.Time +type ImageShareConsumerGetUpdatedAtRetType = time.Time + +func getImageShareConsumerGetUpdatedAtAttributeTypeOk(arg ImageShareConsumerGetUpdatedAtAttributeType) (ret ImageShareConsumerGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setImageShareConsumerGetUpdatedAtAttributeType(arg *ImageShareConsumerGetUpdatedAtAttributeType, val ImageShareConsumerGetUpdatedAtRetType) { + *arg = &val +} + +// ImageShareConsumer The details of an Image share consumer. +type ImageShareConsumer struct { + // Universally Unique Identifier (UUID). + ConsumerProjectId ImageShareConsumerGetConsumerProjectIdAttributeType `json:"consumerProjectId,omitempty"` + // Date-time when resource was created. + CreatedAt ImageShareConsumerGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + ImageId ImageShareConsumerGetImageIdAttributeType `json:"imageId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt ImageShareConsumerGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +// NewImageShareConsumer instantiates a new ImageShareConsumer object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewImageShareConsumer() *ImageShareConsumer { + this := ImageShareConsumer{} + return &this +} + +// NewImageShareConsumerWithDefaults instantiates a new ImageShareConsumer object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewImageShareConsumerWithDefaults() *ImageShareConsumer { + this := ImageShareConsumer{} + return &this +} + +// GetConsumerProjectId returns the ConsumerProjectId field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetConsumerProjectId() (res ImageShareConsumerGetConsumerProjectIdRetType) { + res, _ = o.GetConsumerProjectIdOk() + return +} + +// GetConsumerProjectIdOk returns a tuple with the ConsumerProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetConsumerProjectIdOk() (ret ImageShareConsumerGetConsumerProjectIdRetType, ok bool) { + return getImageShareConsumerGetConsumerProjectIdAttributeTypeOk(o.ConsumerProjectId) +} + +// HasConsumerProjectId returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasConsumerProjectId() bool { + _, ok := o.GetConsumerProjectIdOk() + return ok +} + +// SetConsumerProjectId gets a reference to the given string and assigns it to the ConsumerProjectId field. +func (o *ImageShareConsumer) SetConsumerProjectId(v ImageShareConsumerGetConsumerProjectIdRetType) { + setImageShareConsumerGetConsumerProjectIdAttributeType(&o.ConsumerProjectId, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetCreatedAt() (res ImageShareConsumerGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetCreatedAtOk() (ret ImageShareConsumerGetCreatedAtRetType, ok bool) { + return getImageShareConsumerGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *ImageShareConsumer) SetCreatedAt(v ImageShareConsumerGetCreatedAtRetType) { + setImageShareConsumerGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetImageId() (res ImageShareConsumerGetImageIdRetType) { + res, _ = o.GetImageIdOk() + return +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetImageIdOk() (ret ImageShareConsumerGetImageIdRetType, ok bool) { + return getImageShareConsumerGetImageIdAttributeTypeOk(o.ImageId) +} + +// HasImageId returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasImageId() bool { + _, ok := o.GetImageIdOk() + return ok +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *ImageShareConsumer) SetImageId(v ImageShareConsumerGetImageIdRetType) { + setImageShareConsumerGetImageIdAttributeType(&o.ImageId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *ImageShareConsumer) GetUpdatedAt() (res ImageShareConsumerGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageShareConsumer) GetUpdatedAtOk() (ret ImageShareConsumerGetUpdatedAtRetType, ok bool) { + return getImageShareConsumerGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *ImageShareConsumer) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *ImageShareConsumer) SetUpdatedAt(v ImageShareConsumerGetUpdatedAtRetType) { + setImageShareConsumerGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o ImageShareConsumer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getImageShareConsumerGetConsumerProjectIdAttributeTypeOk(o.ConsumerProjectId); ok { + toSerialize["ConsumerProjectId"] = val + } + if val, ok := getImageShareConsumerGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getImageShareConsumerGetImageIdAttributeTypeOk(o.ImageId); ok { + toSerialize["ImageId"] = val + } + if val, ok := getImageShareConsumerGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableImageShareConsumer struct { + value *ImageShareConsumer + isSet bool +} + +func (v NullableImageShareConsumer) Get() *ImageShareConsumer { + return v.value +} + +func (v *NullableImageShareConsumer) Set(val *ImageShareConsumer) { + v.value = val + v.isSet = true +} + +func (v NullableImageShareConsumer) IsSet() bool { + return v.isSet +} + +func (v *NullableImageShareConsumer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableImageShareConsumer(val *ImageShareConsumer) *NullableImageShareConsumer { + return &NullableImageShareConsumer{value: val, isSet: true} +} + +func (v NullableImageShareConsumer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableImageShareConsumer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_key_pair_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_key_pair_list_response.go new file mode 100644 index 00000000..0c268259 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_key_pair_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the KeyPairListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KeyPairListResponse{} + +/* + types and functions for items +*/ + +// isArray +type KeyPairListResponseGetItemsAttributeType = *[]Keypair +type KeyPairListResponseGetItemsArgType = []Keypair +type KeyPairListResponseGetItemsRetType = []Keypair + +func getKeyPairListResponseGetItemsAttributeTypeOk(arg KeyPairListResponseGetItemsAttributeType) (ret KeyPairListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeyPairListResponseGetItemsAttributeType(arg *KeyPairListResponseGetItemsAttributeType, val KeyPairListResponseGetItemsRetType) { + *arg = &val +} + +// KeyPairListResponse SSH keypair list response. +type KeyPairListResponse struct { + // A list of SSH keypairs. + // REQUIRED + Items KeyPairListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _KeyPairListResponse KeyPairListResponse + +// NewKeyPairListResponse instantiates a new KeyPairListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKeyPairListResponse(items KeyPairListResponseGetItemsArgType) *KeyPairListResponse { + this := KeyPairListResponse{} + setKeyPairListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewKeyPairListResponseWithDefaults instantiates a new KeyPairListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKeyPairListResponseWithDefaults() *KeyPairListResponse { + this := KeyPairListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *KeyPairListResponse) GetItems() (ret KeyPairListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *KeyPairListResponse) GetItemsOk() (ret KeyPairListResponseGetItemsRetType, ok bool) { + return getKeyPairListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *KeyPairListResponse) SetItems(v KeyPairListResponseGetItemsRetType) { + setKeyPairListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o KeyPairListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeyPairListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableKeyPairListResponse struct { + value *KeyPairListResponse + isSet bool +} + +func (v NullableKeyPairListResponse) Get() *KeyPairListResponse { + return v.value +} + +func (v *NullableKeyPairListResponse) Set(val *KeyPairListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableKeyPairListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableKeyPairListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeyPairListResponse(val *KeyPairListResponse) *NullableKeyPairListResponse { + return &NullableKeyPairListResponse{value: val, isSet: true} +} + +func (v NullableKeyPairListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeyPairListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_keypair.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_keypair.go new file mode 100644 index 00000000..0a9dcb65 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_keypair.go @@ -0,0 +1,370 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Keypair type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Keypair{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type KeypairGetCreatedAtAttributeType = *time.Time +type KeypairGetCreatedAtArgType = time.Time +type KeypairGetCreatedAtRetType = time.Time + +func getKeypairGetCreatedAtAttributeTypeOk(arg KeypairGetCreatedAtAttributeType) (ret KeypairGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetCreatedAtAttributeType(arg *KeypairGetCreatedAtAttributeType, val KeypairGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for fingerprint +*/ + +// isNotNullableString +type KeypairGetFingerprintAttributeType = *string + +func getKeypairGetFingerprintAttributeTypeOk(arg KeypairGetFingerprintAttributeType) (ret KeypairGetFingerprintRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetFingerprintAttributeType(arg *KeypairGetFingerprintAttributeType, val KeypairGetFingerprintRetType) { + *arg = &val +} + +type KeypairGetFingerprintArgType = string +type KeypairGetFingerprintRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type KeypairGetLabelsAttributeType = *map[string]interface{} +type KeypairGetLabelsArgType = map[string]interface{} +type KeypairGetLabelsRetType = map[string]interface{} + +func getKeypairGetLabelsAttributeTypeOk(arg KeypairGetLabelsAttributeType) (ret KeypairGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetLabelsAttributeType(arg *KeypairGetLabelsAttributeType, val KeypairGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type KeypairGetNameAttributeType = *string + +func getKeypairGetNameAttributeTypeOk(arg KeypairGetNameAttributeType) (ret KeypairGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetNameAttributeType(arg *KeypairGetNameAttributeType, val KeypairGetNameRetType) { + *arg = &val +} + +type KeypairGetNameArgType = string +type KeypairGetNameRetType = string + +/* + types and functions for publicKey +*/ + +// isNotNullableString +type KeypairGetPublicKeyAttributeType = *string + +func getKeypairGetPublicKeyAttributeTypeOk(arg KeypairGetPublicKeyAttributeType) (ret KeypairGetPublicKeyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetPublicKeyAttributeType(arg *KeypairGetPublicKeyAttributeType, val KeypairGetPublicKeyRetType) { + *arg = &val +} + +type KeypairGetPublicKeyArgType = string +type KeypairGetPublicKeyRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type KeypairGetUpdatedAtAttributeType = *time.Time +type KeypairGetUpdatedAtArgType = time.Time +type KeypairGetUpdatedAtRetType = time.Time + +func getKeypairGetUpdatedAtAttributeTypeOk(arg KeypairGetUpdatedAtAttributeType) (ret KeypairGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setKeypairGetUpdatedAtAttributeType(arg *KeypairGetUpdatedAtAttributeType, val KeypairGetUpdatedAtRetType) { + *arg = &val +} + +// Keypair Object that represents the public key of an SSH keypair and its name. +type Keypair struct { + // Date-time when resource was created. + CreatedAt KeypairGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Object that represents an SSH keypair MD5 fingerprint. + Fingerprint KeypairGetFingerprintAttributeType `json:"fingerprint,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels KeypairGetLabelsAttributeType `json:"labels,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + Name KeypairGetNameAttributeType `json:"name,omitempty"` + // Object that represents a public SSH key. + // REQUIRED + PublicKey KeypairGetPublicKeyAttributeType `json:"publicKey" required:"true"` + // Date-time when resource was last updated. + UpdatedAt KeypairGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Keypair Keypair + +// NewKeypair instantiates a new Keypair object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewKeypair(publicKey KeypairGetPublicKeyArgType) *Keypair { + this := Keypair{} + setKeypairGetPublicKeyAttributeType(&this.PublicKey, publicKey) + return &this +} + +// NewKeypairWithDefaults instantiates a new Keypair object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewKeypairWithDefaults() *Keypair { + this := Keypair{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Keypair) GetCreatedAt() (res KeypairGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetCreatedAtOk() (ret KeypairGetCreatedAtRetType, ok bool) { + return getKeypairGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Keypair) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Keypair) SetCreatedAt(v KeypairGetCreatedAtRetType) { + setKeypairGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetFingerprint returns the Fingerprint field value if set, zero value otherwise. +func (o *Keypair) GetFingerprint() (res KeypairGetFingerprintRetType) { + res, _ = o.GetFingerprintOk() + return +} + +// GetFingerprintOk returns a tuple with the Fingerprint field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetFingerprintOk() (ret KeypairGetFingerprintRetType, ok bool) { + return getKeypairGetFingerprintAttributeTypeOk(o.Fingerprint) +} + +// HasFingerprint returns a boolean if a field has been set. +func (o *Keypair) HasFingerprint() bool { + _, ok := o.GetFingerprintOk() + return ok +} + +// SetFingerprint gets a reference to the given string and assigns it to the Fingerprint field. +func (o *Keypair) SetFingerprint(v KeypairGetFingerprintRetType) { + setKeypairGetFingerprintAttributeType(&o.Fingerprint, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Keypair) GetLabels() (res KeypairGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetLabelsOk() (ret KeypairGetLabelsRetType, ok bool) { + return getKeypairGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Keypair) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Keypair) SetLabels(v KeypairGetLabelsRetType) { + setKeypairGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Keypair) GetName() (res KeypairGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetNameOk() (ret KeypairGetNameRetType, ok bool) { + return getKeypairGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Keypair) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Keypair) SetName(v KeypairGetNameRetType) { + setKeypairGetNameAttributeType(&o.Name, v) +} + +// GetPublicKey returns the PublicKey field value +func (o *Keypair) GetPublicKey() (ret KeypairGetPublicKeyRetType) { + ret, _ = o.GetPublicKeyOk() + return ret +} + +// GetPublicKeyOk returns a tuple with the PublicKey field value +// and a boolean to check if the value has been set. +func (o *Keypair) GetPublicKeyOk() (ret KeypairGetPublicKeyRetType, ok bool) { + return getKeypairGetPublicKeyAttributeTypeOk(o.PublicKey) +} + +// SetPublicKey sets field value +func (o *Keypair) SetPublicKey(v KeypairGetPublicKeyRetType) { + setKeypairGetPublicKeyAttributeType(&o.PublicKey, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Keypair) GetUpdatedAt() (res KeypairGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Keypair) GetUpdatedAtOk() (ret KeypairGetUpdatedAtRetType, ok bool) { + return getKeypairGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Keypair) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Keypair) SetUpdatedAt(v KeypairGetUpdatedAtRetType) { + setKeypairGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Keypair) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getKeypairGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getKeypairGetFingerprintAttributeTypeOk(o.Fingerprint); ok { + toSerialize["Fingerprint"] = val + } + if val, ok := getKeypairGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getKeypairGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getKeypairGetPublicKeyAttributeTypeOk(o.PublicKey); ok { + toSerialize["PublicKey"] = val + } + if val, ok := getKeypairGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableKeypair struct { + value *Keypair + isSet bool +} + +func (v NullableKeypair) Get() *Keypair { + return v.value +} + +func (v *NullableKeypair) Set(val *Keypair) { + v.value = val + v.isSet = true +} + +func (v NullableKeypair) IsSet() bool { + return v.isSet +} + +func (v *NullableKeypair) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableKeypair(val *Keypair) *NullableKeypair { + return &NullableKeypair{value: val, isSet: true} +} + +func (v NullableKeypair) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableKeypair) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_machine_type.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_machine_type.go new file mode 100644 index 00000000..111d1ac2 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_machine_type.go @@ -0,0 +1,356 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the MachineType type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineType{} + +/* + types and functions for description +*/ + +// isNotNullableString +type MachineTypeGetDescriptionAttributeType = *string + +func getMachineTypeGetDescriptionAttributeTypeOk(arg MachineTypeGetDescriptionAttributeType) (ret MachineTypeGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetDescriptionAttributeType(arg *MachineTypeGetDescriptionAttributeType, val MachineTypeGetDescriptionRetType) { + *arg = &val +} + +type MachineTypeGetDescriptionArgType = string +type MachineTypeGetDescriptionRetType = string + +/* + types and functions for disk +*/ + +// isLong +type MachineTypeGetDiskAttributeType = *int64 +type MachineTypeGetDiskArgType = int64 +type MachineTypeGetDiskRetType = int64 + +func getMachineTypeGetDiskAttributeTypeOk(arg MachineTypeGetDiskAttributeType) (ret MachineTypeGetDiskRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetDiskAttributeType(arg *MachineTypeGetDiskAttributeType, val MachineTypeGetDiskRetType) { + *arg = &val +} + +/* + types and functions for extraSpecs +*/ + +// isFreeform +type MachineTypeGetExtraSpecsAttributeType = *map[string]interface{} +type MachineTypeGetExtraSpecsArgType = map[string]interface{} +type MachineTypeGetExtraSpecsRetType = map[string]interface{} + +func getMachineTypeGetExtraSpecsAttributeTypeOk(arg MachineTypeGetExtraSpecsAttributeType) (ret MachineTypeGetExtraSpecsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetExtraSpecsAttributeType(arg *MachineTypeGetExtraSpecsAttributeType, val MachineTypeGetExtraSpecsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type MachineTypeGetNameAttributeType = *string + +func getMachineTypeGetNameAttributeTypeOk(arg MachineTypeGetNameAttributeType) (ret MachineTypeGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetNameAttributeType(arg *MachineTypeGetNameAttributeType, val MachineTypeGetNameRetType) { + *arg = &val +} + +type MachineTypeGetNameArgType = string +type MachineTypeGetNameRetType = string + +/* + types and functions for ram +*/ + +// isLong +type MachineTypeGetRamAttributeType = *int64 +type MachineTypeGetRamArgType = int64 +type MachineTypeGetRamRetType = int64 + +func getMachineTypeGetRamAttributeTypeOk(arg MachineTypeGetRamAttributeType) (ret MachineTypeGetRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetRamAttributeType(arg *MachineTypeGetRamAttributeType, val MachineTypeGetRamRetType) { + *arg = &val +} + +/* + types and functions for vcpus +*/ + +// isLong +type MachineTypeGetVcpusAttributeType = *int64 +type MachineTypeGetVcpusArgType = int64 +type MachineTypeGetVcpusRetType = int64 + +func getMachineTypeGetVcpusAttributeTypeOk(arg MachineTypeGetVcpusAttributeType) (ret MachineTypeGetVcpusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeGetVcpusAttributeType(arg *MachineTypeGetVcpusAttributeType, val MachineTypeGetVcpusRetType) { + *arg = &val +} + +// MachineType Machine Type. Filterable Fields: `disk`, `extraSpecs`, `name`, `ram`, `vcpus`. +type MachineType struct { + // Description Object. Allows string up to 255 Characters. + Description MachineTypeGetDescriptionAttributeType `json:"description,omitempty"` + // Size in Gigabyte. + // REQUIRED + Disk MachineTypeGetDiskAttributeType `json:"disk" required:"true"` + // Properties to control certain aspects or scheduling behavior for an object. + ExtraSpecs MachineTypeGetExtraSpecsAttributeType `json:"extraSpecs,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name MachineTypeGetNameAttributeType `json:"name" required:"true"` + // Size in Megabyte. + // REQUIRED + Ram MachineTypeGetRamAttributeType `json:"ram" required:"true"` + // The number of virtual CPUs of a server. + // REQUIRED + Vcpus MachineTypeGetVcpusAttributeType `json:"vcpus" required:"true"` +} + +type _MachineType MachineType + +// NewMachineType instantiates a new MachineType object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMachineType(disk MachineTypeGetDiskArgType, name MachineTypeGetNameArgType, ram MachineTypeGetRamArgType, vcpus MachineTypeGetVcpusArgType) *MachineType { + this := MachineType{} + setMachineTypeGetDiskAttributeType(&this.Disk, disk) + setMachineTypeGetNameAttributeType(&this.Name, name) + setMachineTypeGetRamAttributeType(&this.Ram, ram) + setMachineTypeGetVcpusAttributeType(&this.Vcpus, vcpus) + return &this +} + +// NewMachineTypeWithDefaults instantiates a new MachineType object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMachineTypeWithDefaults() *MachineType { + this := MachineType{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *MachineType) GetDescription() (res MachineTypeGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MachineType) GetDescriptionOk() (ret MachineTypeGetDescriptionRetType, ok bool) { + return getMachineTypeGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *MachineType) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *MachineType) SetDescription(v MachineTypeGetDescriptionRetType) { + setMachineTypeGetDescriptionAttributeType(&o.Description, v) +} + +// GetDisk returns the Disk field value +func (o *MachineType) GetDisk() (ret MachineTypeGetDiskRetType) { + ret, _ = o.GetDiskOk() + return ret +} + +// GetDiskOk returns a tuple with the Disk field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetDiskOk() (ret MachineTypeGetDiskRetType, ok bool) { + return getMachineTypeGetDiskAttributeTypeOk(o.Disk) +} + +// SetDisk sets field value +func (o *MachineType) SetDisk(v MachineTypeGetDiskRetType) { + setMachineTypeGetDiskAttributeType(&o.Disk, v) +} + +// GetExtraSpecs returns the ExtraSpecs field value if set, zero value otherwise. +func (o *MachineType) GetExtraSpecs() (res MachineTypeGetExtraSpecsRetType) { + res, _ = o.GetExtraSpecsOk() + return +} + +// GetExtraSpecsOk returns a tuple with the ExtraSpecs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MachineType) GetExtraSpecsOk() (ret MachineTypeGetExtraSpecsRetType, ok bool) { + return getMachineTypeGetExtraSpecsAttributeTypeOk(o.ExtraSpecs) +} + +// HasExtraSpecs returns a boolean if a field has been set. +func (o *MachineType) HasExtraSpecs() bool { + _, ok := o.GetExtraSpecsOk() + return ok +} + +// SetExtraSpecs gets a reference to the given map[string]interface{} and assigns it to the ExtraSpecs field. +func (o *MachineType) SetExtraSpecs(v MachineTypeGetExtraSpecsRetType) { + setMachineTypeGetExtraSpecsAttributeType(&o.ExtraSpecs, v) +} + +// GetName returns the Name field value +func (o *MachineType) GetName() (ret MachineTypeGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetNameOk() (ret MachineTypeGetNameRetType, ok bool) { + return getMachineTypeGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *MachineType) SetName(v MachineTypeGetNameRetType) { + setMachineTypeGetNameAttributeType(&o.Name, v) +} + +// GetRam returns the Ram field value +func (o *MachineType) GetRam() (ret MachineTypeGetRamRetType) { + ret, _ = o.GetRamOk() + return ret +} + +// GetRamOk returns a tuple with the Ram field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetRamOk() (ret MachineTypeGetRamRetType, ok bool) { + return getMachineTypeGetRamAttributeTypeOk(o.Ram) +} + +// SetRam sets field value +func (o *MachineType) SetRam(v MachineTypeGetRamRetType) { + setMachineTypeGetRamAttributeType(&o.Ram, v) +} + +// GetVcpus returns the Vcpus field value +func (o *MachineType) GetVcpus() (ret MachineTypeGetVcpusRetType) { + ret, _ = o.GetVcpusOk() + return ret +} + +// GetVcpusOk returns a tuple with the Vcpus field value +// and a boolean to check if the value has been set. +func (o *MachineType) GetVcpusOk() (ret MachineTypeGetVcpusRetType, ok bool) { + return getMachineTypeGetVcpusAttributeTypeOk(o.Vcpus) +} + +// SetVcpus sets field value +func (o *MachineType) SetVcpus(v MachineTypeGetVcpusRetType) { + setMachineTypeGetVcpusAttributeType(&o.Vcpus, v) +} + +func (o MachineType) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineTypeGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getMachineTypeGetDiskAttributeTypeOk(o.Disk); ok { + toSerialize["Disk"] = val + } + if val, ok := getMachineTypeGetExtraSpecsAttributeTypeOk(o.ExtraSpecs); ok { + toSerialize["ExtraSpecs"] = val + } + if val, ok := getMachineTypeGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getMachineTypeGetRamAttributeTypeOk(o.Ram); ok { + toSerialize["Ram"] = val + } + if val, ok := getMachineTypeGetVcpusAttributeTypeOk(o.Vcpus); ok { + toSerialize["Vcpus"] = val + } + return toSerialize, nil +} + +type NullableMachineType struct { + value *MachineType + isSet bool +} + +func (v NullableMachineType) Get() *MachineType { + return v.value +} + +func (v *NullableMachineType) Set(val *MachineType) { + v.value = val + v.isSet = true +} + +func (v NullableMachineType) IsSet() bool { + return v.isSet +} + +func (v *NullableMachineType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMachineType(val *MachineType) *NullableMachineType { + return &NullableMachineType{value: val, isSet: true} +} + +func (v NullableMachineType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMachineType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_machine_type_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_machine_type_list_response.go new file mode 100644 index 00000000..c0d9f41a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_machine_type_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the MachineTypeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MachineTypeListResponse{} + +/* + types and functions for items +*/ + +// isArray +type MachineTypeListResponseGetItemsAttributeType = *[]MachineType +type MachineTypeListResponseGetItemsArgType = []MachineType +type MachineTypeListResponseGetItemsRetType = []MachineType + +func getMachineTypeListResponseGetItemsAttributeTypeOk(arg MachineTypeListResponseGetItemsAttributeType) (ret MachineTypeListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setMachineTypeListResponseGetItemsAttributeType(arg *MachineTypeListResponseGetItemsAttributeType, val MachineTypeListResponseGetItemsRetType) { + *arg = &val +} + +// MachineTypeListResponse Machine type list response. +type MachineTypeListResponse struct { + // Machine type list. + // REQUIRED + Items MachineTypeListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _MachineTypeListResponse MachineTypeListResponse + +// NewMachineTypeListResponse instantiates a new MachineTypeListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMachineTypeListResponse(items MachineTypeListResponseGetItemsArgType) *MachineTypeListResponse { + this := MachineTypeListResponse{} + setMachineTypeListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewMachineTypeListResponseWithDefaults instantiates a new MachineTypeListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMachineTypeListResponseWithDefaults() *MachineTypeListResponse { + this := MachineTypeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *MachineTypeListResponse) GetItems() (ret MachineTypeListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *MachineTypeListResponse) GetItemsOk() (ret MachineTypeListResponseGetItemsRetType, ok bool) { + return getMachineTypeListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *MachineTypeListResponse) SetItems(v MachineTypeListResponseGetItemsRetType) { + setMachineTypeListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o MachineTypeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getMachineTypeListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableMachineTypeListResponse struct { + value *MachineTypeListResponse + isSet bool +} + +func (v NullableMachineTypeListResponse) Get() *MachineTypeListResponse { + return v.value +} + +func (v *NullableMachineTypeListResponse) Set(val *MachineTypeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableMachineTypeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableMachineTypeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMachineTypeListResponse(val *MachineTypeListResponse) *NullableMachineTypeListResponse { + return &NullableMachineTypeListResponse{value: val, isSet: true} +} + +func (v NullableMachineTypeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMachineTypeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network.go new file mode 100644 index 00000000..cf269411 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network.go @@ -0,0 +1,600 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Network type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Network{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type NetworkGetCreatedAtAttributeType = *time.Time +type NetworkGetCreatedAtArgType = time.Time +type NetworkGetCreatedAtRetType = time.Time + +func getNetworkGetCreatedAtAttributeTypeOk(arg NetworkGetCreatedAtAttributeType) (ret NetworkGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetCreatedAtAttributeType(arg *NetworkGetCreatedAtAttributeType, val NetworkGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for dhcp +*/ + +// isBoolean +type NetworkgetDhcpAttributeType = *bool +type NetworkgetDhcpArgType = bool +type NetworkgetDhcpRetType = bool + +func getNetworkgetDhcpAttributeTypeOk(arg NetworkgetDhcpAttributeType) (ret NetworkgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkgetDhcpAttributeType(arg *NetworkgetDhcpAttributeType, val NetworkgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type NetworkGetIdAttributeType = *string + +func getNetworkGetIdAttributeTypeOk(arg NetworkGetIdAttributeType) (ret NetworkGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIdAttributeType(arg *NetworkGetIdAttributeType, val NetworkGetIdRetType) { + *arg = &val +} + +type NetworkGetIdArgType = string +type NetworkGetIdRetType = string + +/* + types and functions for ipv4 +*/ + +// isModel +type NetworkGetIpv4AttributeType = *NetworkIPv4 +type NetworkGetIpv4ArgType = NetworkIPv4 +type NetworkGetIpv4RetType = NetworkIPv4 + +func getNetworkGetIpv4AttributeTypeOk(arg NetworkGetIpv4AttributeType) (ret NetworkGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIpv4AttributeType(arg *NetworkGetIpv4AttributeType, val NetworkGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type NetworkGetIpv6AttributeType = *NetworkIPv6 +type NetworkGetIpv6ArgType = NetworkIPv6 +type NetworkGetIpv6RetType = NetworkIPv6 + +func getNetworkGetIpv6AttributeTypeOk(arg NetworkGetIpv6AttributeType) (ret NetworkGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetIpv6AttributeType(arg *NetworkGetIpv6AttributeType, val NetworkGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type NetworkGetLabelsAttributeType = *map[string]interface{} +type NetworkGetLabelsArgType = map[string]interface{} +type NetworkGetLabelsRetType = map[string]interface{} + +func getNetworkGetLabelsAttributeTypeOk(arg NetworkGetLabelsAttributeType) (ret NetworkGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetLabelsAttributeType(arg *NetworkGetLabelsAttributeType, val NetworkGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type NetworkGetNameAttributeType = *string + +func getNetworkGetNameAttributeTypeOk(arg NetworkGetNameAttributeType) (ret NetworkGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetNameAttributeType(arg *NetworkGetNameAttributeType, val NetworkGetNameRetType) { + *arg = &val +} + +type NetworkGetNameArgType = string +type NetworkGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type NetworkgetRoutedAttributeType = *bool +type NetworkgetRoutedArgType = bool +type NetworkgetRoutedRetType = bool + +func getNetworkgetRoutedAttributeTypeOk(arg NetworkgetRoutedAttributeType) (ret NetworkgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkgetRoutedAttributeType(arg *NetworkgetRoutedAttributeType, val NetworkgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type NetworkGetRoutingTableIdAttributeType = *string + +func getNetworkGetRoutingTableIdAttributeTypeOk(arg NetworkGetRoutingTableIdAttributeType) (ret NetworkGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetRoutingTableIdAttributeType(arg *NetworkGetRoutingTableIdAttributeType, val NetworkGetRoutingTableIdRetType) { + *arg = &val +} + +type NetworkGetRoutingTableIdArgType = string +type NetworkGetRoutingTableIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type NetworkGetStatusAttributeType = *string + +func getNetworkGetStatusAttributeTypeOk(arg NetworkGetStatusAttributeType) (ret NetworkGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetStatusAttributeType(arg *NetworkGetStatusAttributeType, val NetworkGetStatusRetType) { + *arg = &val +} + +type NetworkGetStatusArgType = string +type NetworkGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type NetworkGetUpdatedAtAttributeType = *time.Time +type NetworkGetUpdatedAtArgType = time.Time +type NetworkGetUpdatedAtRetType = time.Time + +func getNetworkGetUpdatedAtAttributeTypeOk(arg NetworkGetUpdatedAtAttributeType) (ret NetworkGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkGetUpdatedAtAttributeType(arg *NetworkGetUpdatedAtAttributeType, val NetworkGetUpdatedAtRetType) { + *arg = &val +} + +// Network Object that represents a network. If no routing table is specified, the default routing table is used. +type Network struct { + // Date-time when resource was created. + CreatedAt NetworkGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Enable or disable DHCP for a network. + Dhcp NetworkgetDhcpAttributeType `json:"dhcp,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + Id NetworkGetIdAttributeType `json:"id" required:"true"` + Ipv4 NetworkGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 NetworkGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels NetworkGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Name NetworkGetNameAttributeType `json:"name" required:"true"` + // Shows if the network is routed and therefore accessible from other networks. + Routed NetworkgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId NetworkGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status NetworkGetStatusAttributeType `json:"status" required:"true"` + // Date-time when resource was last updated. + UpdatedAt NetworkGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Network Network + +// NewNetwork instantiates a new Network object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetwork(id NetworkGetIdArgType, name NetworkGetNameArgType, status NetworkGetStatusArgType) *Network { + this := Network{} + setNetworkGetIdAttributeType(&this.Id, id) + setNetworkGetNameAttributeType(&this.Name, name) + setNetworkGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewNetworkWithDefaults instantiates a new Network object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkWithDefaults() *Network { + this := Network{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Network) GetCreatedAt() (res NetworkGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetCreatedAtOk() (ret NetworkGetCreatedAtRetType, ok bool) { + return getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Network) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Network) SetCreatedAt(v NetworkGetCreatedAtRetType) { + setNetworkGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *Network) GetDhcp() (res NetworkgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetDhcpOk() (ret NetworkgetDhcpRetType, ok bool) { + return getNetworkgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *Network) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *Network) SetDhcp(v NetworkgetDhcpRetType) { + setNetworkgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetId returns the Id field value +func (o *Network) GetId() (ret NetworkGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Network) GetIdOk() (ret NetworkGetIdRetType, ok bool) { + return getNetworkGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Network) SetId(v NetworkGetIdRetType) { + setNetworkGetIdAttributeType(&o.Id, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *Network) GetIpv4() (res NetworkGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetIpv4Ok() (ret NetworkGetIpv4RetType, ok bool) { + return getNetworkGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *Network) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given NetworkIPv4 and assigns it to the Ipv4 field. +func (o *Network) SetIpv4(v NetworkGetIpv4RetType) { + setNetworkGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *Network) GetIpv6() (res NetworkGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetIpv6Ok() (ret NetworkGetIpv6RetType, ok bool) { + return getNetworkGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *Network) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given NetworkIPv6 and assigns it to the Ipv6 field. +func (o *Network) SetIpv6(v NetworkGetIpv6RetType) { + setNetworkGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Network) GetLabels() (res NetworkGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetLabelsOk() (ret NetworkGetLabelsRetType, ok bool) { + return getNetworkGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Network) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Network) SetLabels(v NetworkGetLabelsRetType) { + setNetworkGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *Network) GetName() (ret NetworkGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Network) GetNameOk() (ret NetworkGetNameRetType, ok bool) { + return getNetworkGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Network) SetName(v NetworkGetNameRetType) { + setNetworkGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *Network) GetRouted() (res NetworkgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetRoutedOk() (ret NetworkgetRoutedRetType, ok bool) { + return getNetworkgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *Network) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *Network) SetRouted(v NetworkgetRoutedRetType) { + setNetworkgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *Network) GetRoutingTableId() (res NetworkGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetRoutingTableIdOk() (ret NetworkGetRoutingTableIdRetType, ok bool) { + return getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *Network) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *Network) SetRoutingTableId(v NetworkGetRoutingTableIdRetType) { + setNetworkGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +// GetStatus returns the Status field value +func (o *Network) GetStatus() (ret NetworkGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Network) GetStatusOk() (ret NetworkGetStatusRetType, ok bool) { + return getNetworkGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Network) SetStatus(v NetworkGetStatusRetType) { + setNetworkGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Network) GetUpdatedAt() (res NetworkGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Network) GetUpdatedAtOk() (ret NetworkGetUpdatedAtRetType, ok bool) { + return getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Network) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Network) SetUpdatedAt(v NetworkGetUpdatedAtRetType) { + setNetworkGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Network) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getNetworkgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getNetworkGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNetworkGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getNetworkGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getNetworkGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNetworkGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNetworkgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getNetworkGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + if val, ok := getNetworkGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getNetworkGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableNetwork struct { + value *Network + isSet bool +} + +func (v NullableNetwork) Get() *Network { + return v.value +} + +func (v *NullableNetwork) Set(val *Network) { + v.value = val + v.isSet = true +} + +func (v NullableNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetwork(val *Network) *NullableNetwork { + return &NullableNetwork{value: val, isSet: true} +} + +func (v NullableNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area.go new file mode 100644 index 00000000..054fcce7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area.go @@ -0,0 +1,368 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the NetworkArea type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkArea{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type NetworkAreaGetCreatedAtAttributeType = *time.Time +type NetworkAreaGetCreatedAtArgType = time.Time +type NetworkAreaGetCreatedAtRetType = time.Time + +func getNetworkAreaGetCreatedAtAttributeTypeOk(arg NetworkAreaGetCreatedAtAttributeType) (ret NetworkAreaGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetCreatedAtAttributeType(arg *NetworkAreaGetCreatedAtAttributeType, val NetworkAreaGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type NetworkAreaGetIdAttributeType = *string + +func getNetworkAreaGetIdAttributeTypeOk(arg NetworkAreaGetIdAttributeType) (ret NetworkAreaGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetIdAttributeType(arg *NetworkAreaGetIdAttributeType, val NetworkAreaGetIdRetType) { + *arg = &val +} + +type NetworkAreaGetIdArgType = string +type NetworkAreaGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type NetworkAreaGetLabelsAttributeType = *map[string]interface{} +type NetworkAreaGetLabelsArgType = map[string]interface{} +type NetworkAreaGetLabelsRetType = map[string]interface{} + +func getNetworkAreaGetLabelsAttributeTypeOk(arg NetworkAreaGetLabelsAttributeType) (ret NetworkAreaGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetLabelsAttributeType(arg *NetworkAreaGetLabelsAttributeType, val NetworkAreaGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type NetworkAreaGetNameAttributeType = *string + +func getNetworkAreaGetNameAttributeTypeOk(arg NetworkAreaGetNameAttributeType) (ret NetworkAreaGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetNameAttributeType(arg *NetworkAreaGetNameAttributeType, val NetworkAreaGetNameRetType) { + *arg = &val +} + +type NetworkAreaGetNameArgType = string +type NetworkAreaGetNameRetType = string + +/* + types and functions for projectCount +*/ + +// isLong +type NetworkAreaGetProjectCountAttributeType = *int64 +type NetworkAreaGetProjectCountArgType = int64 +type NetworkAreaGetProjectCountRetType = int64 + +func getNetworkAreaGetProjectCountAttributeTypeOk(arg NetworkAreaGetProjectCountAttributeType) (ret NetworkAreaGetProjectCountRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetProjectCountAttributeType(arg *NetworkAreaGetProjectCountAttributeType, val NetworkAreaGetProjectCountRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type NetworkAreaGetUpdatedAtAttributeType = *time.Time +type NetworkAreaGetUpdatedAtArgType = time.Time +type NetworkAreaGetUpdatedAtRetType = time.Time + +func getNetworkAreaGetUpdatedAtAttributeTypeOk(arg NetworkAreaGetUpdatedAtAttributeType) (ret NetworkAreaGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaGetUpdatedAtAttributeType(arg *NetworkAreaGetUpdatedAtAttributeType, val NetworkAreaGetUpdatedAtRetType) { + *arg = &val +} + +// NetworkArea Object that represents a network area. +type NetworkArea struct { + // Date-time when resource was created. + CreatedAt NetworkAreaGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id NetworkAreaGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels NetworkAreaGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Name NetworkAreaGetNameAttributeType `json:"name" required:"true"` + // The amount of projects currently referencing a specific area. + ProjectCount NetworkAreaGetProjectCountAttributeType `json:"projectCount,omitempty"` + // Date-time when resource was last updated. + UpdatedAt NetworkAreaGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _NetworkArea NetworkArea + +// NewNetworkArea instantiates a new NetworkArea object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkArea(name NetworkAreaGetNameArgType) *NetworkArea { + this := NetworkArea{} + setNetworkAreaGetNameAttributeType(&this.Name, name) + return &this +} + +// NewNetworkAreaWithDefaults instantiates a new NetworkArea object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkAreaWithDefaults() *NetworkArea { + this := NetworkArea{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *NetworkArea) GetCreatedAt() (res NetworkAreaGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetCreatedAtOk() (ret NetworkAreaGetCreatedAtRetType, ok bool) { + return getNetworkAreaGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *NetworkArea) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *NetworkArea) SetCreatedAt(v NetworkAreaGetCreatedAtRetType) { + setNetworkAreaGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkArea) GetId() (res NetworkAreaGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetIdOk() (ret NetworkAreaGetIdRetType, ok bool) { + return getNetworkAreaGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *NetworkArea) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkArea) SetId(v NetworkAreaGetIdRetType) { + setNetworkAreaGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *NetworkArea) GetLabels() (res NetworkAreaGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetLabelsOk() (ret NetworkAreaGetLabelsRetType, ok bool) { + return getNetworkAreaGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *NetworkArea) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *NetworkArea) SetLabels(v NetworkAreaGetLabelsRetType) { + setNetworkAreaGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *NetworkArea) GetName() (ret NetworkAreaGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetNameOk() (ret NetworkAreaGetNameRetType, ok bool) { + return getNetworkAreaGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *NetworkArea) SetName(v NetworkAreaGetNameRetType) { + setNetworkAreaGetNameAttributeType(&o.Name, v) +} + +// GetProjectCount returns the ProjectCount field value if set, zero value otherwise. +func (o *NetworkArea) GetProjectCount() (res NetworkAreaGetProjectCountRetType) { + res, _ = o.GetProjectCountOk() + return +} + +// GetProjectCountOk returns a tuple with the ProjectCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetProjectCountOk() (ret NetworkAreaGetProjectCountRetType, ok bool) { + return getNetworkAreaGetProjectCountAttributeTypeOk(o.ProjectCount) +} + +// HasProjectCount returns a boolean if a field has been set. +func (o *NetworkArea) HasProjectCount() bool { + _, ok := o.GetProjectCountOk() + return ok +} + +// SetProjectCount gets a reference to the given int64 and assigns it to the ProjectCount field. +func (o *NetworkArea) SetProjectCount(v NetworkAreaGetProjectCountRetType) { + setNetworkAreaGetProjectCountAttributeType(&o.ProjectCount, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *NetworkArea) GetUpdatedAt() (res NetworkAreaGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkArea) GetUpdatedAtOk() (ret NetworkAreaGetUpdatedAtRetType, ok bool) { + return getNetworkAreaGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *NetworkArea) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *NetworkArea) SetUpdatedAt(v NetworkAreaGetUpdatedAtRetType) { + setNetworkAreaGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o NetworkArea) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkAreaGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getNetworkAreaGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNetworkAreaGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNetworkAreaGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNetworkAreaGetProjectCountAttributeTypeOk(o.ProjectCount); ok { + toSerialize["ProjectCount"] = val + } + if val, ok := getNetworkAreaGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableNetworkArea struct { + value *NetworkArea + isSet bool +} + +func (v NullableNetworkArea) Get() *NetworkArea { + return v.value +} + +func (v *NullableNetworkArea) Set(val *NetworkArea) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkArea) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkArea) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkArea(val *NetworkArea) *NullableNetworkArea { + return &NullableNetworkArea{value: val, isSet: true} +} + +func (v NullableNetworkArea) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkArea) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area_ipv4.go new file mode 100644 index 00000000..80f5e19b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area_ipv4.go @@ -0,0 +1,423 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NetworkAreaIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkAreaIPv4{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type NetworkAreaIPv4GetDefaultNameserversAttributeType = *[]string +type NetworkAreaIPv4GetDefaultNameserversArgType = []string +type NetworkAreaIPv4GetDefaultNameserversRetType = []string + +func getNetworkAreaIPv4GetDefaultNameserversAttributeTypeOk(arg NetworkAreaIPv4GetDefaultNameserversAttributeType) (ret NetworkAreaIPv4GetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaIPv4GetDefaultNameserversAttributeType(arg *NetworkAreaIPv4GetDefaultNameserversAttributeType, val NetworkAreaIPv4GetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for networkRanges +*/ + +// isArray +type NetworkAreaIPv4GetNetworkRangesAttributeType = *[]NetworkRange +type NetworkAreaIPv4GetNetworkRangesArgType = []NetworkRange +type NetworkAreaIPv4GetNetworkRangesRetType = []NetworkRange + +func getNetworkAreaIPv4GetNetworkRangesAttributeTypeOk(arg NetworkAreaIPv4GetNetworkRangesAttributeType) (ret NetworkAreaIPv4GetNetworkRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaIPv4GetNetworkRangesAttributeType(arg *NetworkAreaIPv4GetNetworkRangesAttributeType, val NetworkAreaIPv4GetNetworkRangesRetType) { + *arg = &val +} + +/* + types and functions for routes +*/ + +// isArray +type NetworkAreaIPv4GetRoutesAttributeType = *[]Route +type NetworkAreaIPv4GetRoutesArgType = []Route +type NetworkAreaIPv4GetRoutesRetType = []Route + +func getNetworkAreaIPv4GetRoutesAttributeTypeOk(arg NetworkAreaIPv4GetRoutesAttributeType) (ret NetworkAreaIPv4GetRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaIPv4GetRoutesAttributeType(arg *NetworkAreaIPv4GetRoutesAttributeType, val NetworkAreaIPv4GetRoutesRetType) { + *arg = &val +} + +/* + types and functions for transferNetwork +*/ + +// isNotNullableString +type NetworkAreaIPv4GetTransferNetworkAttributeType = *string + +func getNetworkAreaIPv4GetTransferNetworkAttributeTypeOk(arg NetworkAreaIPv4GetTransferNetworkAttributeType) (ret NetworkAreaIPv4GetTransferNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaIPv4GetTransferNetworkAttributeType(arg *NetworkAreaIPv4GetTransferNetworkAttributeType, val NetworkAreaIPv4GetTransferNetworkRetType) { + *arg = &val +} + +type NetworkAreaIPv4GetTransferNetworkArgType = string +type NetworkAreaIPv4GetTransferNetworkRetType = string + +/* + types and functions for defaultPrefixLen +*/ + +// isInteger +type NetworkAreaIPv4GetDefaultPrefixLenAttributeType = *int64 +type NetworkAreaIPv4GetDefaultPrefixLenArgType = int64 +type NetworkAreaIPv4GetDefaultPrefixLenRetType = int64 + +func getNetworkAreaIPv4GetDefaultPrefixLenAttributeTypeOk(arg NetworkAreaIPv4GetDefaultPrefixLenAttributeType) (ret NetworkAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaIPv4GetDefaultPrefixLenAttributeType(arg *NetworkAreaIPv4GetDefaultPrefixLenAttributeType, val NetworkAreaIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isInteger +type NetworkAreaIPv4GetMaxPrefixLenAttributeType = *int64 +type NetworkAreaIPv4GetMaxPrefixLenArgType = int64 +type NetworkAreaIPv4GetMaxPrefixLenRetType = int64 + +func getNetworkAreaIPv4GetMaxPrefixLenAttributeTypeOk(arg NetworkAreaIPv4GetMaxPrefixLenAttributeType) (ret NetworkAreaIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaIPv4GetMaxPrefixLenAttributeType(arg *NetworkAreaIPv4GetMaxPrefixLenAttributeType, val NetworkAreaIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isInteger +type NetworkAreaIPv4GetMinPrefixLenAttributeType = *int64 +type NetworkAreaIPv4GetMinPrefixLenArgType = int64 +type NetworkAreaIPv4GetMinPrefixLenRetType = int64 + +func getNetworkAreaIPv4GetMinPrefixLenAttributeTypeOk(arg NetworkAreaIPv4GetMinPrefixLenAttributeType) (ret NetworkAreaIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaIPv4GetMinPrefixLenAttributeType(arg *NetworkAreaIPv4GetMinPrefixLenAttributeType, val NetworkAreaIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +// NetworkAreaIPv4 The IPv4 properties of a network area. +type NetworkAreaIPv4 struct { + // A list containing DNS Servers/Nameservers for IPv4. + DefaultNameservers NetworkAreaIPv4GetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // A list of network ranges. + NetworkRanges NetworkAreaIPv4GetNetworkRangesAttributeType `json:"networkRanges,omitempty"` + // A list of routes. + Routes NetworkAreaIPv4GetRoutesAttributeType `json:"routes,omitempty"` + // Classless Inter-Domain Routing (CIDR). + TransferNetwork NetworkAreaIPv4GetTransferNetworkAttributeType `json:"transferNetwork,omitempty"` + // The default prefix length for networks in the network area. + DefaultPrefixLen NetworkAreaIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen,omitempty"` + // The maximal prefix length for networks in the network area. + MaxPrefixLen NetworkAreaIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen,omitempty"` + // The minimal prefix length for networks in the network area. + MinPrefixLen NetworkAreaIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen,omitempty"` +} + +// NewNetworkAreaIPv4 instantiates a new NetworkAreaIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkAreaIPv4() *NetworkAreaIPv4 { + this := NetworkAreaIPv4{} + return &this +} + +// NewNetworkAreaIPv4WithDefaults instantiates a new NetworkAreaIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkAreaIPv4WithDefaults() *NetworkAreaIPv4 { + this := NetworkAreaIPv4{} + var defaultPrefixLen int64 = 25 + this.DefaultPrefixLen = &defaultPrefixLen + var maxPrefixLen int64 = 29 + this.MaxPrefixLen = &maxPrefixLen + var minPrefixLen int64 = 24 + this.MinPrefixLen = &minPrefixLen + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *NetworkAreaIPv4) GetDefaultNameservers() (res NetworkAreaIPv4GetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkAreaIPv4) GetDefaultNameserversOk() (ret NetworkAreaIPv4GetDefaultNameserversRetType, ok bool) { + return getNetworkAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *NetworkAreaIPv4) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *NetworkAreaIPv4) SetDefaultNameservers(v NetworkAreaIPv4GetDefaultNameserversRetType) { + setNetworkAreaIPv4GetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetNetworkRanges returns the NetworkRanges field value if set, zero value otherwise. +func (o *NetworkAreaIPv4) GetNetworkRanges() (res NetworkAreaIPv4GetNetworkRangesRetType) { + res, _ = o.GetNetworkRangesOk() + return +} + +// GetNetworkRangesOk returns a tuple with the NetworkRanges field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkAreaIPv4) GetNetworkRangesOk() (ret NetworkAreaIPv4GetNetworkRangesRetType, ok bool) { + return getNetworkAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges) +} + +// HasNetworkRanges returns a boolean if a field has been set. +func (o *NetworkAreaIPv4) HasNetworkRanges() bool { + _, ok := o.GetNetworkRangesOk() + return ok +} + +// SetNetworkRanges gets a reference to the given []NetworkRange and assigns it to the NetworkRanges field. +func (o *NetworkAreaIPv4) SetNetworkRanges(v NetworkAreaIPv4GetNetworkRangesRetType) { + setNetworkAreaIPv4GetNetworkRangesAttributeType(&o.NetworkRanges, v) +} + +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *NetworkAreaIPv4) GetRoutes() (res NetworkAreaIPv4GetRoutesRetType) { + res, _ = o.GetRoutesOk() + return +} + +// GetRoutesOk returns a tuple with the Routes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkAreaIPv4) GetRoutesOk() (ret NetworkAreaIPv4GetRoutesRetType, ok bool) { + return getNetworkAreaIPv4GetRoutesAttributeTypeOk(o.Routes) +} + +// HasRoutes returns a boolean if a field has been set. +func (o *NetworkAreaIPv4) HasRoutes() bool { + _, ok := o.GetRoutesOk() + return ok +} + +// SetRoutes gets a reference to the given []Route and assigns it to the Routes field. +func (o *NetworkAreaIPv4) SetRoutes(v NetworkAreaIPv4GetRoutesRetType) { + setNetworkAreaIPv4GetRoutesAttributeType(&o.Routes, v) +} + +// GetTransferNetwork returns the TransferNetwork field value if set, zero value otherwise. +func (o *NetworkAreaIPv4) GetTransferNetwork() (res NetworkAreaIPv4GetTransferNetworkRetType) { + res, _ = o.GetTransferNetworkOk() + return +} + +// GetTransferNetworkOk returns a tuple with the TransferNetwork field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkAreaIPv4) GetTransferNetworkOk() (ret NetworkAreaIPv4GetTransferNetworkRetType, ok bool) { + return getNetworkAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork) +} + +// HasTransferNetwork returns a boolean if a field has been set. +func (o *NetworkAreaIPv4) HasTransferNetwork() bool { + _, ok := o.GetTransferNetworkOk() + return ok +} + +// SetTransferNetwork gets a reference to the given string and assigns it to the TransferNetwork field. +func (o *NetworkAreaIPv4) SetTransferNetwork(v NetworkAreaIPv4GetTransferNetworkRetType) { + setNetworkAreaIPv4GetTransferNetworkAttributeType(&o.TransferNetwork, v) +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value if set, zero value otherwise. +func (o *NetworkAreaIPv4) GetDefaultPrefixLen() (res NetworkAreaIPv4GetDefaultPrefixLenRetType) { + res, _ = o.GetDefaultPrefixLenOk() + return +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkAreaIPv4) GetDefaultPrefixLenOk() (ret NetworkAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + return getNetworkAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// HasDefaultPrefixLen returns a boolean if a field has been set. +func (o *NetworkAreaIPv4) HasDefaultPrefixLen() bool { + _, ok := o.GetDefaultPrefixLenOk() + return ok +} + +// SetDefaultPrefixLen gets a reference to the given int64 and assigns it to the DefaultPrefixLen field. +func (o *NetworkAreaIPv4) SetDefaultPrefixLen(v NetworkAreaIPv4GetDefaultPrefixLenRetType) { + setNetworkAreaIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value if set, zero value otherwise. +func (o *NetworkAreaIPv4) GetMaxPrefixLen() (res NetworkAreaIPv4GetMaxPrefixLenRetType) { + res, _ = o.GetMaxPrefixLenOk() + return +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkAreaIPv4) GetMaxPrefixLenOk() (ret NetworkAreaIPv4GetMaxPrefixLenRetType, ok bool) { + return getNetworkAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// HasMaxPrefixLen returns a boolean if a field has been set. +func (o *NetworkAreaIPv4) HasMaxPrefixLen() bool { + _, ok := o.GetMaxPrefixLenOk() + return ok +} + +// SetMaxPrefixLen gets a reference to the given int64 and assigns it to the MaxPrefixLen field. +func (o *NetworkAreaIPv4) SetMaxPrefixLen(v NetworkAreaIPv4GetMaxPrefixLenRetType) { + setNetworkAreaIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value if set, zero value otherwise. +func (o *NetworkAreaIPv4) GetMinPrefixLen() (res NetworkAreaIPv4GetMinPrefixLenRetType) { + res, _ = o.GetMinPrefixLenOk() + return +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkAreaIPv4) GetMinPrefixLenOk() (ret NetworkAreaIPv4GetMinPrefixLenRetType, ok bool) { + return getNetworkAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// HasMinPrefixLen returns a boolean if a field has been set. +func (o *NetworkAreaIPv4) HasMinPrefixLen() bool { + _, ok := o.GetMinPrefixLenOk() + return ok +} + +// SetMinPrefixLen gets a reference to the given int64 and assigns it to the MinPrefixLen field. +func (o *NetworkAreaIPv4) SetMinPrefixLen(v NetworkAreaIPv4GetMinPrefixLenRetType) { + setNetworkAreaIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +func (o NetworkAreaIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getNetworkAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges); ok { + toSerialize["NetworkRanges"] = val + } + if val, ok := getNetworkAreaIPv4GetRoutesAttributeTypeOk(o.Routes); ok { + toSerialize["Routes"] = val + } + if val, ok := getNetworkAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork); ok { + toSerialize["TransferNetwork"] = val + } + if val, ok := getNetworkAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getNetworkAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getNetworkAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + return toSerialize, nil +} + +type NullableNetworkAreaIPv4 struct { + value *NetworkAreaIPv4 + isSet bool +} + +func (v NullableNetworkAreaIPv4) Get() *NetworkAreaIPv4 { + return v.value +} + +func (v *NullableNetworkAreaIPv4) Set(val *NetworkAreaIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkAreaIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkAreaIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkAreaIPv4(val *NetworkAreaIPv4) *NullableNetworkAreaIPv4 { + return &NullableNetworkAreaIPv4{value: val, isSet: true} +} + +func (v NullableNetworkAreaIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkAreaIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area_list_response.go new file mode 100644 index 00000000..ba1dac04 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_area_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NetworkAreaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkAreaListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NetworkAreaListResponseGetItemsAttributeType = *[]NetworkArea +type NetworkAreaListResponseGetItemsArgType = []NetworkArea +type NetworkAreaListResponseGetItemsRetType = []NetworkArea + +func getNetworkAreaListResponseGetItemsAttributeTypeOk(arg NetworkAreaListResponseGetItemsAttributeType) (ret NetworkAreaListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkAreaListResponseGetItemsAttributeType(arg *NetworkAreaListResponseGetItemsAttributeType, val NetworkAreaListResponseGetItemsRetType) { + *arg = &val +} + +// NetworkAreaListResponse Network area list response. +type NetworkAreaListResponse struct { + // A list of network areas. + // REQUIRED + Items NetworkAreaListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NetworkAreaListResponse NetworkAreaListResponse + +// NewNetworkAreaListResponse instantiates a new NetworkAreaListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkAreaListResponse(items NetworkAreaListResponseGetItemsArgType) *NetworkAreaListResponse { + this := NetworkAreaListResponse{} + setNetworkAreaListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNetworkAreaListResponseWithDefaults instantiates a new NetworkAreaListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkAreaListResponseWithDefaults() *NetworkAreaListResponse { + this := NetworkAreaListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NetworkAreaListResponse) GetItems() (ret NetworkAreaListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NetworkAreaListResponse) GetItemsOk() (ret NetworkAreaListResponseGetItemsRetType, ok bool) { + return getNetworkAreaListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NetworkAreaListResponse) SetItems(v NetworkAreaListResponseGetItemsRetType) { + setNetworkAreaListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NetworkAreaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkAreaListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNetworkAreaListResponse struct { + value *NetworkAreaListResponse + isSet bool +} + +func (v NullableNetworkAreaListResponse) Get() *NetworkAreaListResponse { + return v.value +} + +func (v *NullableNetworkAreaListResponse) Set(val *NetworkAreaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkAreaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkAreaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkAreaListResponse(val *NetworkAreaListResponse) *NullableNetworkAreaListResponse { + return &NullableNetworkAreaListResponse{value: val, isSet: true} +} + +func (v NullableNetworkAreaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkAreaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_ipv4.go new file mode 100644 index 00000000..e7eaf820 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_ipv4.go @@ -0,0 +1,286 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NetworkIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkIPv4{} + +/* + types and functions for gateway +*/ + +// isNullableString +type NetworkIPv4GetGatewayAttributeType = *NullableString + +func getNetworkIPv4GetGatewayAttributeTypeOk(arg NetworkIPv4GetGatewayAttributeType) (ret NetworkIPv4GetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setNetworkIPv4GetGatewayAttributeType(arg *NetworkIPv4GetGatewayAttributeType, val NetworkIPv4GetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type NetworkIPv4GetGatewayArgType = *string +type NetworkIPv4GetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type NetworkIPv4GetNameserversAttributeType = *[]string +type NetworkIPv4GetNameserversArgType = []string +type NetworkIPv4GetNameserversRetType = []string + +func getNetworkIPv4GetNameserversAttributeTypeOk(arg NetworkIPv4GetNameserversAttributeType) (ret NetworkIPv4GetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetNameserversAttributeType(arg *NetworkIPv4GetNameserversAttributeType, val NetworkIPv4GetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixes +*/ + +// isArray +type NetworkIPv4GetPrefixesAttributeType = *[]string +type NetworkIPv4GetPrefixesArgType = []string +type NetworkIPv4GetPrefixesRetType = []string + +func getNetworkIPv4GetPrefixesAttributeTypeOk(arg NetworkIPv4GetPrefixesAttributeType) (ret NetworkIPv4GetPrefixesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetPrefixesAttributeType(arg *NetworkIPv4GetPrefixesAttributeType, val NetworkIPv4GetPrefixesRetType) { + *arg = &val +} + +/* + types and functions for publicIp +*/ + +// isNotNullableString +type NetworkIPv4GetPublicIpAttributeType = *string + +func getNetworkIPv4GetPublicIpAttributeTypeOk(arg NetworkIPv4GetPublicIpAttributeType) (ret NetworkIPv4GetPublicIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv4GetPublicIpAttributeType(arg *NetworkIPv4GetPublicIpAttributeType, val NetworkIPv4GetPublicIpRetType) { + *arg = &val +} + +type NetworkIPv4GetPublicIpArgType = string +type NetworkIPv4GetPublicIpRetType = string + +// NetworkIPv4 Object that represents the IPv4 part of a network. +type NetworkIPv4 struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway NetworkIPv4GetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers NetworkIPv4GetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + Prefixes NetworkIPv4GetPrefixesAttributeType `json:"prefixes" required:"true"` + // String that represents an IPv4 address. + PublicIp NetworkIPv4GetPublicIpAttributeType `json:"publicIp,omitempty"` +} + +type _NetworkIPv4 NetworkIPv4 + +// NewNetworkIPv4 instantiates a new NetworkIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkIPv4(prefixes NetworkIPv4GetPrefixesArgType) *NetworkIPv4 { + this := NetworkIPv4{} + setNetworkIPv4GetPrefixesAttributeType(&this.Prefixes, prefixes) + return &this +} + +// NewNetworkIPv4WithDefaults instantiates a new NetworkIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkIPv4WithDefaults() *NetworkIPv4 { + this := NetworkIPv4{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NetworkIPv4) GetGateway() (res NetworkIPv4GetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NetworkIPv4) GetGatewayOk() (ret NetworkIPv4GetGatewayRetType, ok bool) { + return getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *NetworkIPv4) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *NetworkIPv4) SetGateway(v NetworkIPv4GetGatewayRetType) { + setNetworkIPv4GetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *NetworkIPv4) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *NetworkIPv4) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *NetworkIPv4) GetNameservers() (res NetworkIPv4GetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetNameserversOk() (ret NetworkIPv4GetNameserversRetType, ok bool) { + return getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *NetworkIPv4) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *NetworkIPv4) SetNameservers(v NetworkIPv4GetNameserversRetType) { + setNetworkIPv4GetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixes returns the Prefixes field value +func (o *NetworkIPv4) GetPrefixes() (ret NetworkIPv4GetPrefixesRetType) { + ret, _ = o.GetPrefixesOk() + return ret +} + +// GetPrefixesOk returns a tuple with the Prefixes field value +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetPrefixesOk() (ret NetworkIPv4GetPrefixesRetType, ok bool) { + return getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes) +} + +// SetPrefixes sets field value +func (o *NetworkIPv4) SetPrefixes(v NetworkIPv4GetPrefixesRetType) { + setNetworkIPv4GetPrefixesAttributeType(&o.Prefixes, v) +} + +// GetPublicIp returns the PublicIp field value if set, zero value otherwise. +func (o *NetworkIPv4) GetPublicIp() (res NetworkIPv4GetPublicIpRetType) { + res, _ = o.GetPublicIpOk() + return +} + +// GetPublicIpOk returns a tuple with the PublicIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv4) GetPublicIpOk() (ret NetworkIPv4GetPublicIpRetType, ok bool) { + return getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp) +} + +// HasPublicIp returns a boolean if a field has been set. +func (o *NetworkIPv4) HasPublicIp() bool { + _, ok := o.GetPublicIpOk() + return ok +} + +// SetPublicIp gets a reference to the given string and assigns it to the PublicIp field. +func (o *NetworkIPv4) SetPublicIp(v NetworkIPv4GetPublicIpRetType) { + setNetworkIPv4GetPublicIpAttributeType(&o.PublicIp, v) +} + +func (o NetworkIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkIPv4GetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getNetworkIPv4GetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getNetworkIPv4GetPrefixesAttributeTypeOk(o.Prefixes); ok { + toSerialize["Prefixes"] = val + } + if val, ok := getNetworkIPv4GetPublicIpAttributeTypeOk(o.PublicIp); ok { + toSerialize["PublicIp"] = val + } + return toSerialize, nil +} + +type NullableNetworkIPv4 struct { + value *NetworkIPv4 + isSet bool +} + +func (v NullableNetworkIPv4) Get() *NetworkIPv4 { + return v.value +} + +func (v *NullableNetworkIPv4) Set(val *NetworkIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkIPv4(val *NetworkIPv4) *NullableNetworkIPv4 { + return &NullableNetworkIPv4{value: val, isSet: true} +} + +func (v NullableNetworkIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_ipv6.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_ipv6.go new file mode 100644 index 00000000..72274462 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_ipv6.go @@ -0,0 +1,237 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NetworkIPv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkIPv6{} + +/* + types and functions for gateway +*/ + +// isNullableString +type NetworkIPv6GetGatewayAttributeType = *NullableString + +func getNetworkIPv6GetGatewayAttributeTypeOk(arg NetworkIPv6GetGatewayAttributeType) (ret NetworkIPv6GetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setNetworkIPv6GetGatewayAttributeType(arg *NetworkIPv6GetGatewayAttributeType, val NetworkIPv6GetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type NetworkIPv6GetGatewayArgType = *string +type NetworkIPv6GetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type NetworkIPv6GetNameserversAttributeType = *[]string +type NetworkIPv6GetNameserversArgType = []string +type NetworkIPv6GetNameserversRetType = []string + +func getNetworkIPv6GetNameserversAttributeTypeOk(arg NetworkIPv6GetNameserversAttributeType) (ret NetworkIPv6GetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv6GetNameserversAttributeType(arg *NetworkIPv6GetNameserversAttributeType, val NetworkIPv6GetNameserversRetType) { + *arg = &val +} + +/* + types and functions for prefixes +*/ + +// isArray +type NetworkIPv6GetPrefixesAttributeType = *[]string +type NetworkIPv6GetPrefixesArgType = []string +type NetworkIPv6GetPrefixesRetType = []string + +func getNetworkIPv6GetPrefixesAttributeTypeOk(arg NetworkIPv6GetPrefixesAttributeType) (ret NetworkIPv6GetPrefixesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkIPv6GetPrefixesAttributeType(arg *NetworkIPv6GetPrefixesAttributeType, val NetworkIPv6GetPrefixesRetType) { + *arg = &val +} + +// NetworkIPv6 Object that represents the IPv6 part of a network. +type NetworkIPv6 struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway NetworkIPv6GetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers NetworkIPv6GetNameserversAttributeType `json:"nameservers,omitempty"` + // REQUIRED + Prefixes NetworkIPv6GetPrefixesAttributeType `json:"prefixes" required:"true"` +} + +type _NetworkIPv6 NetworkIPv6 + +// NewNetworkIPv6 instantiates a new NetworkIPv6 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkIPv6(prefixes NetworkIPv6GetPrefixesArgType) *NetworkIPv6 { + this := NetworkIPv6{} + setNetworkIPv6GetPrefixesAttributeType(&this.Prefixes, prefixes) + return &this +} + +// NewNetworkIPv6WithDefaults instantiates a new NetworkIPv6 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkIPv6WithDefaults() *NetworkIPv6 { + this := NetworkIPv6{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NetworkIPv6) GetGateway() (res NetworkIPv6GetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *NetworkIPv6) GetGatewayOk() (ret NetworkIPv6GetGatewayRetType, ok bool) { + return getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *NetworkIPv6) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *NetworkIPv6) SetGateway(v NetworkIPv6GetGatewayRetType) { + setNetworkIPv6GetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *NetworkIPv6) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *NetworkIPv6) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *NetworkIPv6) GetNameservers() (res NetworkIPv6GetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkIPv6) GetNameserversOk() (ret NetworkIPv6GetNameserversRetType, ok bool) { + return getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *NetworkIPv6) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *NetworkIPv6) SetNameservers(v NetworkIPv6GetNameserversRetType) { + setNetworkIPv6GetNameserversAttributeType(&o.Nameservers, v) +} + +// GetPrefixes returns the Prefixes field value +func (o *NetworkIPv6) GetPrefixes() (ret NetworkIPv6GetPrefixesRetType) { + ret, _ = o.GetPrefixesOk() + return ret +} + +// GetPrefixesOk returns a tuple with the Prefixes field value +// and a boolean to check if the value has been set. +func (o *NetworkIPv6) GetPrefixesOk() (ret NetworkIPv6GetPrefixesRetType, ok bool) { + return getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes) +} + +// SetPrefixes sets field value +func (o *NetworkIPv6) SetPrefixes(v NetworkIPv6GetPrefixesRetType) { + setNetworkIPv6GetPrefixesAttributeType(&o.Prefixes, v) +} + +func (o NetworkIPv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkIPv6GetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getNetworkIPv6GetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + if val, ok := getNetworkIPv6GetPrefixesAttributeTypeOk(o.Prefixes); ok { + toSerialize["Prefixes"] = val + } + return toSerialize, nil +} + +type NullableNetworkIPv6 struct { + value *NetworkIPv6 + isSet bool +} + +func (v NullableNetworkIPv6) Get() *NetworkIPv6 { + return v.value +} + +func (v *NullableNetworkIPv6) Set(val *NetworkIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkIPv6(val *NetworkIPv6) *NullableNetworkIPv6 { + return &NullableNetworkIPv6{value: val, isSet: true} +} + +func (v NullableNetworkIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_list_response.go new file mode 100644 index 00000000..6fcec490 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NetworkListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NetworkListResponseGetItemsAttributeType = *[]Network +type NetworkListResponseGetItemsArgType = []Network +type NetworkListResponseGetItemsRetType = []Network + +func getNetworkListResponseGetItemsAttributeTypeOk(arg NetworkListResponseGetItemsAttributeType) (ret NetworkListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkListResponseGetItemsAttributeType(arg *NetworkListResponseGetItemsAttributeType, val NetworkListResponseGetItemsRetType) { + *arg = &val +} + +// NetworkListResponse Network list response. +type NetworkListResponse struct { + // A list of networks. + // REQUIRED + Items NetworkListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NetworkListResponse NetworkListResponse + +// NewNetworkListResponse instantiates a new NetworkListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkListResponse(items NetworkListResponseGetItemsArgType) *NetworkListResponse { + this := NetworkListResponse{} + setNetworkListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNetworkListResponseWithDefaults instantiates a new NetworkListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkListResponseWithDefaults() *NetworkListResponse { + this := NetworkListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NetworkListResponse) GetItems() (ret NetworkListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NetworkListResponse) GetItemsOk() (ret NetworkListResponseGetItemsRetType, ok bool) { + return getNetworkListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NetworkListResponse) SetItems(v NetworkListResponseGetItemsRetType) { + setNetworkListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NetworkListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNetworkListResponse struct { + value *NetworkListResponse + isSet bool +} + +func (v NullableNetworkListResponse) Get() *NetworkListResponse { + return v.value +} + +func (v *NullableNetworkListResponse) Set(val *NetworkListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkListResponse(val *NetworkListResponse) *NullableNetworkListResponse { + return &NullableNetworkListResponse{value: val, isSet: true} +} + +func (v NullableNetworkListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_range.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_range.go new file mode 100644 index 00000000..9f68dddb --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_range.go @@ -0,0 +1,273 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the NetworkRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkRange{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type NetworkRangeGetCreatedAtAttributeType = *time.Time +type NetworkRangeGetCreatedAtArgType = time.Time +type NetworkRangeGetCreatedAtRetType = time.Time + +func getNetworkRangeGetCreatedAtAttributeTypeOk(arg NetworkRangeGetCreatedAtAttributeType) (ret NetworkRangeGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetCreatedAtAttributeType(arg *NetworkRangeGetCreatedAtAttributeType, val NetworkRangeGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type NetworkRangeGetIdAttributeType = *string + +func getNetworkRangeGetIdAttributeTypeOk(arg NetworkRangeGetIdAttributeType) (ret NetworkRangeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetIdAttributeType(arg *NetworkRangeGetIdAttributeType, val NetworkRangeGetIdRetType) { + *arg = &val +} + +type NetworkRangeGetIdArgType = string +type NetworkRangeGetIdRetType = string + +/* + types and functions for prefix +*/ + +// isNotNullableString +type NetworkRangeGetPrefixAttributeType = *string + +func getNetworkRangeGetPrefixAttributeTypeOk(arg NetworkRangeGetPrefixAttributeType) (ret NetworkRangeGetPrefixRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetPrefixAttributeType(arg *NetworkRangeGetPrefixAttributeType, val NetworkRangeGetPrefixRetType) { + *arg = &val +} + +type NetworkRangeGetPrefixArgType = string +type NetworkRangeGetPrefixRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type NetworkRangeGetUpdatedAtAttributeType = *time.Time +type NetworkRangeGetUpdatedAtArgType = time.Time +type NetworkRangeGetUpdatedAtRetType = time.Time + +func getNetworkRangeGetUpdatedAtAttributeTypeOk(arg NetworkRangeGetUpdatedAtAttributeType) (ret NetworkRangeGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeGetUpdatedAtAttributeType(arg *NetworkRangeGetUpdatedAtAttributeType, val NetworkRangeGetUpdatedAtRetType) { + *arg = &val +} + +// NetworkRange Object that represents a network range. +type NetworkRange struct { + // Date-time when resource was created. + CreatedAt NetworkRangeGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id NetworkRangeGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + // REQUIRED + Prefix NetworkRangeGetPrefixAttributeType `json:"prefix" required:"true"` + // Date-time when resource was last updated. + UpdatedAt NetworkRangeGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _NetworkRange NetworkRange + +// NewNetworkRange instantiates a new NetworkRange object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkRange(prefix NetworkRangeGetPrefixArgType) *NetworkRange { + this := NetworkRange{} + setNetworkRangeGetPrefixAttributeType(&this.Prefix, prefix) + return &this +} + +// NewNetworkRangeWithDefaults instantiates a new NetworkRange object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkRangeWithDefaults() *NetworkRange { + this := NetworkRange{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *NetworkRange) GetCreatedAt() (res NetworkRangeGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetCreatedAtOk() (ret NetworkRangeGetCreatedAtRetType, ok bool) { + return getNetworkRangeGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *NetworkRange) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *NetworkRange) SetCreatedAt(v NetworkRangeGetCreatedAtRetType) { + setNetworkRangeGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkRange) GetId() (res NetworkRangeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetIdOk() (ret NetworkRangeGetIdRetType, ok bool) { + return getNetworkRangeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *NetworkRange) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkRange) SetId(v NetworkRangeGetIdRetType) { + setNetworkRangeGetIdAttributeType(&o.Id, v) +} + +// GetPrefix returns the Prefix field value +func (o *NetworkRange) GetPrefix() (ret NetworkRangeGetPrefixRetType) { + ret, _ = o.GetPrefixOk() + return ret +} + +// GetPrefixOk returns a tuple with the Prefix field value +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetPrefixOk() (ret NetworkRangeGetPrefixRetType, ok bool) { + return getNetworkRangeGetPrefixAttributeTypeOk(o.Prefix) +} + +// SetPrefix sets field value +func (o *NetworkRange) SetPrefix(v NetworkRangeGetPrefixRetType) { + setNetworkRangeGetPrefixAttributeType(&o.Prefix, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *NetworkRange) GetUpdatedAt() (res NetworkRangeGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetworkRange) GetUpdatedAtOk() (ret NetworkRangeGetUpdatedAtRetType, ok bool) { + return getNetworkRangeGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *NetworkRange) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *NetworkRange) SetUpdatedAt(v NetworkRangeGetUpdatedAtRetType) { + setNetworkRangeGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o NetworkRange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkRangeGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getNetworkRangeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNetworkRangeGetPrefixAttributeTypeOk(o.Prefix); ok { + toSerialize["Prefix"] = val + } + if val, ok := getNetworkRangeGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableNetworkRange struct { + value *NetworkRange + isSet bool +} + +func (v NullableNetworkRange) Get() *NetworkRange { + return v.value +} + +func (v *NullableNetworkRange) Set(val *NetworkRange) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRange) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRange(val *NetworkRange) *NullableNetworkRange { + return &NullableNetworkRange{value: val, isSet: true} +} + +func (v NullableNetworkRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_range_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_range_list_response.go new file mode 100644 index 00000000..1b0132fc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_network_range_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NetworkRangeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkRangeListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NetworkRangeListResponseGetItemsAttributeType = *[]NetworkRange +type NetworkRangeListResponseGetItemsArgType = []NetworkRange +type NetworkRangeListResponseGetItemsRetType = []NetworkRange + +func getNetworkRangeListResponseGetItemsAttributeTypeOk(arg NetworkRangeListResponseGetItemsAttributeType) (ret NetworkRangeListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNetworkRangeListResponseGetItemsAttributeType(arg *NetworkRangeListResponseGetItemsAttributeType, val NetworkRangeListResponseGetItemsRetType) { + *arg = &val +} + +// NetworkRangeListResponse Network Range list response. +type NetworkRangeListResponse struct { + // A list of network ranges. + // REQUIRED + Items NetworkRangeListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NetworkRangeListResponse NetworkRangeListResponse + +// NewNetworkRangeListResponse instantiates a new NetworkRangeListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNetworkRangeListResponse(items NetworkRangeListResponseGetItemsArgType) *NetworkRangeListResponse { + this := NetworkRangeListResponse{} + setNetworkRangeListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNetworkRangeListResponseWithDefaults instantiates a new NetworkRangeListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNetworkRangeListResponseWithDefaults() *NetworkRangeListResponse { + this := NetworkRangeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NetworkRangeListResponse) GetItems() (ret NetworkRangeListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NetworkRangeListResponse) GetItemsOk() (ret NetworkRangeListResponseGetItemsRetType, ok bool) { + return getNetworkRangeListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NetworkRangeListResponse) SetItems(v NetworkRangeListResponseGetItemsRetType) { + setNetworkRangeListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NetworkRangeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNetworkRangeListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNetworkRangeListResponse struct { + value *NetworkRangeListResponse + isSet bool +} + +func (v NullableNetworkRangeListResponse) Get() *NetworkRangeListResponse { + return v.value +} + +func (v *NullableNetworkRangeListResponse) Set(val *NetworkRangeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNetworkRangeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNetworkRangeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNetworkRangeListResponse(val *NetworkRangeListResponse) *NullableNetworkRangeListResponse { + return &NullableNetworkRangeListResponse{value: val, isSet: true} +} + +func (v NullableNetworkRangeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNetworkRangeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_blackhole.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_blackhole.go new file mode 100644 index 00000000..8b295491 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_blackhole.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NexthopBlackhole type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopBlackhole{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopBlackholeGetTypeAttributeType = *string + +func getNexthopBlackholeGetTypeAttributeTypeOk(arg NexthopBlackholeGetTypeAttributeType) (ret NexthopBlackholeGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopBlackholeGetTypeAttributeType(arg *NexthopBlackholeGetTypeAttributeType, val NexthopBlackholeGetTypeRetType) { + *arg = &val +} + +type NexthopBlackholeGetTypeArgType = string +type NexthopBlackholeGetTypeRetType = string + +// NexthopBlackhole Object that represents a blackhole route. +type NexthopBlackhole struct { + // REQUIRED + Type NexthopBlackholeGetTypeAttributeType `json:"type" required:"true"` +} + +type _NexthopBlackhole NexthopBlackhole + +// NewNexthopBlackhole instantiates a new NexthopBlackhole object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNexthopBlackhole(types NexthopBlackholeGetTypeArgType) *NexthopBlackhole { + this := NexthopBlackhole{} + setNexthopBlackholeGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewNexthopBlackholeWithDefaults instantiates a new NexthopBlackhole object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNexthopBlackholeWithDefaults() *NexthopBlackhole { + this := NexthopBlackhole{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopBlackhole) GetType() (ret NexthopBlackholeGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopBlackhole) GetTypeOk() (ret NexthopBlackholeGetTypeRetType, ok bool) { + return getNexthopBlackholeGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopBlackhole) SetType(v NexthopBlackholeGetTypeRetType) { + setNexthopBlackholeGetTypeAttributeType(&o.Type, v) +} + +func (o NexthopBlackhole) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopBlackholeGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNexthopBlackhole struct { + value *NexthopBlackhole + isSet bool +} + +func (v NullableNexthopBlackhole) Get() *NexthopBlackhole { + return v.value +} + +func (v *NullableNexthopBlackhole) Set(val *NexthopBlackhole) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopBlackhole) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopBlackhole) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopBlackhole(val *NexthopBlackhole) *NullableNexthopBlackhole { + return &NullableNexthopBlackhole{value: val, isSet: true} +} + +func (v NullableNexthopBlackhole) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopBlackhole) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_internet.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_internet.go new file mode 100644 index 00000000..e4809b67 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_internet.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NexthopInternet type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopInternet{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopInternetGetTypeAttributeType = *string + +func getNexthopInternetGetTypeAttributeTypeOk(arg NexthopInternetGetTypeAttributeType) (ret NexthopInternetGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopInternetGetTypeAttributeType(arg *NexthopInternetGetTypeAttributeType, val NexthopInternetGetTypeRetType) { + *arg = &val +} + +type NexthopInternetGetTypeArgType = string +type NexthopInternetGetTypeRetType = string + +// NexthopInternet Object that represents a route to the internet. +type NexthopInternet struct { + // REQUIRED + Type NexthopInternetGetTypeAttributeType `json:"type" required:"true"` +} + +type _NexthopInternet NexthopInternet + +// NewNexthopInternet instantiates a new NexthopInternet object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNexthopInternet(types NexthopInternetGetTypeArgType) *NexthopInternet { + this := NexthopInternet{} + setNexthopInternetGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewNexthopInternetWithDefaults instantiates a new NexthopInternet object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNexthopInternetWithDefaults() *NexthopInternet { + this := NexthopInternet{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopInternet) GetType() (ret NexthopInternetGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopInternet) GetTypeOk() (ret NexthopInternetGetTypeRetType, ok bool) { + return getNexthopInternetGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopInternet) SetType(v NexthopInternetGetTypeRetType) { + setNexthopInternetGetTypeAttributeType(&o.Type, v) +} + +func (o NexthopInternet) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopInternetGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNexthopInternet struct { + value *NexthopInternet + isSet bool +} + +func (v NullableNexthopInternet) Get() *NexthopInternet { + return v.value +} + +func (v *NullableNexthopInternet) Set(val *NexthopInternet) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopInternet) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopInternet) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopInternet(val *NexthopInternet) *NullableNexthopInternet { + return &NullableNexthopInternet{value: val, isSet: true} +} + +func (v NullableNexthopInternet) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopInternet) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_ipv4.go new file mode 100644 index 00000000..dc4d69f5 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_ipv4.go @@ -0,0 +1,171 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NexthopIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopIPv4{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopIPv4GetTypeAttributeType = *string + +func getNexthopIPv4GetTypeAttributeTypeOk(arg NexthopIPv4GetTypeAttributeType) (ret NexthopIPv4GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv4GetTypeAttributeType(arg *NexthopIPv4GetTypeAttributeType, val NexthopIPv4GetTypeRetType) { + *arg = &val +} + +type NexthopIPv4GetTypeArgType = string +type NexthopIPv4GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type NexthopIPv4GetValueAttributeType = *string + +func getNexthopIPv4GetValueAttributeTypeOk(arg NexthopIPv4GetValueAttributeType) (ret NexthopIPv4GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv4GetValueAttributeType(arg *NexthopIPv4GetValueAttributeType, val NexthopIPv4GetValueRetType) { + *arg = &val +} + +type NexthopIPv4GetValueArgType = string +type NexthopIPv4GetValueRetType = string + +// NexthopIPv4 Object that represents an IPv4 address. +type NexthopIPv4 struct { + // REQUIRED + Type NexthopIPv4GetTypeAttributeType `json:"type" required:"true"` + // An IPv4 address. + // REQUIRED + Value NexthopIPv4GetValueAttributeType `json:"value" required:"true"` +} + +type _NexthopIPv4 NexthopIPv4 + +// NewNexthopIPv4 instantiates a new NexthopIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNexthopIPv4(types NexthopIPv4GetTypeArgType, value NexthopIPv4GetValueArgType) *NexthopIPv4 { + this := NexthopIPv4{} + setNexthopIPv4GetTypeAttributeType(&this.Type, types) + setNexthopIPv4GetValueAttributeType(&this.Value, value) + return &this +} + +// NewNexthopIPv4WithDefaults instantiates a new NexthopIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNexthopIPv4WithDefaults() *NexthopIPv4 { + this := NexthopIPv4{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopIPv4) GetType() (ret NexthopIPv4GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv4) GetTypeOk() (ret NexthopIPv4GetTypeRetType, ok bool) { + return getNexthopIPv4GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopIPv4) SetType(v NexthopIPv4GetTypeRetType) { + setNexthopIPv4GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *NexthopIPv4) GetValue() (ret NexthopIPv4GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv4) GetValueOk() (ret NexthopIPv4GetValueRetType, ok bool) { + return getNexthopIPv4GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *NexthopIPv4) SetValue(v NexthopIPv4GetValueRetType) { + setNexthopIPv4GetValueAttributeType(&o.Value, v) +} + +func (o NexthopIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopIPv4GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getNexthopIPv4GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableNexthopIPv4 struct { + value *NexthopIPv4 + isSet bool +} + +func (v NullableNexthopIPv4) Get() *NexthopIPv4 { + return v.value +} + +func (v *NullableNexthopIPv4) Set(val *NexthopIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopIPv4(val *NexthopIPv4) *NullableNexthopIPv4 { + return &NullableNexthopIPv4{value: val, isSet: true} +} + +func (v NullableNexthopIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_ipv6.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_ipv6.go new file mode 100644 index 00000000..abe97129 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nexthop_ipv6.go @@ -0,0 +1,171 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NexthopIPv6 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NexthopIPv6{} + +/* + types and functions for type +*/ + +// isNotNullableString +type NexthopIPv6GetTypeAttributeType = *string + +func getNexthopIPv6GetTypeAttributeTypeOk(arg NexthopIPv6GetTypeAttributeType) (ret NexthopIPv6GetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv6GetTypeAttributeType(arg *NexthopIPv6GetTypeAttributeType, val NexthopIPv6GetTypeRetType) { + *arg = &val +} + +type NexthopIPv6GetTypeArgType = string +type NexthopIPv6GetTypeRetType = string + +/* + types and functions for value +*/ + +// isNotNullableString +type NexthopIPv6GetValueAttributeType = *string + +func getNexthopIPv6GetValueAttributeTypeOk(arg NexthopIPv6GetValueAttributeType) (ret NexthopIPv6GetValueRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNexthopIPv6GetValueAttributeType(arg *NexthopIPv6GetValueAttributeType, val NexthopIPv6GetValueRetType) { + *arg = &val +} + +type NexthopIPv6GetValueArgType = string +type NexthopIPv6GetValueRetType = string + +// NexthopIPv6 Object that represents an IPv6 address. +type NexthopIPv6 struct { + // REQUIRED + Type NexthopIPv6GetTypeAttributeType `json:"type" required:"true"` + // An IPv6 address. + // REQUIRED + Value NexthopIPv6GetValueAttributeType `json:"value" required:"true"` +} + +type _NexthopIPv6 NexthopIPv6 + +// NewNexthopIPv6 instantiates a new NexthopIPv6 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNexthopIPv6(types NexthopIPv6GetTypeArgType, value NexthopIPv6GetValueArgType) *NexthopIPv6 { + this := NexthopIPv6{} + setNexthopIPv6GetTypeAttributeType(&this.Type, types) + setNexthopIPv6GetValueAttributeType(&this.Value, value) + return &this +} + +// NewNexthopIPv6WithDefaults instantiates a new NexthopIPv6 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNexthopIPv6WithDefaults() *NexthopIPv6 { + this := NexthopIPv6{} + return &this +} + +// GetType returns the Type field value +func (o *NexthopIPv6) GetType() (ret NexthopIPv6GetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv6) GetTypeOk() (ret NexthopIPv6GetTypeRetType, ok bool) { + return getNexthopIPv6GetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *NexthopIPv6) SetType(v NexthopIPv6GetTypeRetType) { + setNexthopIPv6GetTypeAttributeType(&o.Type, v) +} + +// GetValue returns the Value field value +func (o *NexthopIPv6) GetValue() (ret NexthopIPv6GetValueRetType) { + ret, _ = o.GetValueOk() + return ret +} + +// GetValueOk returns a tuple with the Value field value +// and a boolean to check if the value has been set. +func (o *NexthopIPv6) GetValueOk() (ret NexthopIPv6GetValueRetType, ok bool) { + return getNexthopIPv6GetValueAttributeTypeOk(o.Value) +} + +// SetValue sets field value +func (o *NexthopIPv6) SetValue(v NexthopIPv6GetValueRetType) { + setNexthopIPv6GetValueAttributeType(&o.Value, v) +} + +func (o NexthopIPv6) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNexthopIPv6GetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + if val, ok := getNexthopIPv6GetValueAttributeTypeOk(o.Value); ok { + toSerialize["Value"] = val + } + return toSerialize, nil +} + +type NullableNexthopIPv6 struct { + value *NexthopIPv6 + isSet bool +} + +func (v NullableNexthopIPv6) Get() *NexthopIPv6 { + return v.value +} + +func (v *NullableNexthopIPv6) Set(val *NexthopIPv6) { + v.value = val + v.isSet = true +} + +func (v NullableNexthopIPv6) IsSet() bool { + return v.isSet +} + +func (v *NullableNexthopIPv6) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNexthopIPv6(val *NexthopIPv6) *NullableNexthopIPv6 { + return &NullableNexthopIPv6{value: val, isSet: true} +} + +func (v NullableNexthopIPv6) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNexthopIPv6) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nic.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nic.go new file mode 100644 index 00000000..1cb718d0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nic.go @@ -0,0 +1,764 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NIC type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NIC{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type NICGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type NICGetAllowedAddressesArgType = []AllowedAddressesInner +type NICGetAllowedAddressesRetType = []AllowedAddressesInner + +func getNICGetAllowedAddressesAttributeTypeOk(arg NICGetAllowedAddressesAttributeType) (ret NICGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetAllowedAddressesAttributeType(arg *NICGetAllowedAddressesAttributeType, val NICGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type NICGetDescriptionAttributeType = *string + +func getNICGetDescriptionAttributeTypeOk(arg NICGetDescriptionAttributeType) (ret NICGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetDescriptionAttributeType(arg *NICGetDescriptionAttributeType, val NICGetDescriptionRetType) { + *arg = &val +} + +type NICGetDescriptionArgType = string +type NICGetDescriptionRetType = string + +/* + types and functions for device +*/ + +// isNotNullableString +type NICGetDeviceAttributeType = *string + +func getNICGetDeviceAttributeTypeOk(arg NICGetDeviceAttributeType) (ret NICGetDeviceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetDeviceAttributeType(arg *NICGetDeviceAttributeType, val NICGetDeviceRetType) { + *arg = &val +} + +type NICGetDeviceArgType = string +type NICGetDeviceRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type NICGetIdAttributeType = *string + +func getNICGetIdAttributeTypeOk(arg NICGetIdAttributeType) (ret NICGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetIdAttributeType(arg *NICGetIdAttributeType, val NICGetIdRetType) { + *arg = &val +} + +type NICGetIdArgType = string +type NICGetIdRetType = string + +/* + types and functions for ipv4 +*/ + +// isNotNullableString +type NICGetIpv4AttributeType = *string + +func getNICGetIpv4AttributeTypeOk(arg NICGetIpv4AttributeType) (ret NICGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetIpv4AttributeType(arg *NICGetIpv4AttributeType, val NICGetIpv4RetType) { + *arg = &val +} + +type NICGetIpv4ArgType = string +type NICGetIpv4RetType = string + +/* + types and functions for ipv6 +*/ + +// isNotNullableString +type NICGetIpv6AttributeType = *string + +func getNICGetIpv6AttributeTypeOk(arg NICGetIpv6AttributeType) (ret NICGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetIpv6AttributeType(arg *NICGetIpv6AttributeType, val NICGetIpv6RetType) { + *arg = &val +} + +type NICGetIpv6ArgType = string +type NICGetIpv6RetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type NICGetLabelsAttributeType = *map[string]interface{} +type NICGetLabelsArgType = map[string]interface{} +type NICGetLabelsRetType = map[string]interface{} + +func getNICGetLabelsAttributeTypeOk(arg NICGetLabelsAttributeType) (ret NICGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetLabelsAttributeType(arg *NICGetLabelsAttributeType, val NICGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for mac +*/ + +// isNotNullableString +type NICGetMacAttributeType = *string + +func getNICGetMacAttributeTypeOk(arg NICGetMacAttributeType) (ret NICGetMacRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetMacAttributeType(arg *NICGetMacAttributeType, val NICGetMacRetType) { + *arg = &val +} + +type NICGetMacArgType = string +type NICGetMacRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type NICGetNameAttributeType = *string + +func getNICGetNameAttributeTypeOk(arg NICGetNameAttributeType) (ret NICGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetNameAttributeType(arg *NICGetNameAttributeType, val NICGetNameRetType) { + *arg = &val +} + +type NICGetNameArgType = string +type NICGetNameRetType = string + +/* + types and functions for networkId +*/ + +// isNotNullableString +type NICGetNetworkIdAttributeType = *string + +func getNICGetNetworkIdAttributeTypeOk(arg NICGetNetworkIdAttributeType) (ret NICGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetNetworkIdAttributeType(arg *NICGetNetworkIdAttributeType, val NICGetNetworkIdRetType) { + *arg = &val +} + +type NICGetNetworkIdArgType = string +type NICGetNetworkIdRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type NICgetNicSecurityAttributeType = *bool +type NICgetNicSecurityArgType = bool +type NICgetNicSecurityRetType = bool + +func getNICgetNicSecurityAttributeTypeOk(arg NICgetNicSecurityAttributeType) (ret NICgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICgetNicSecurityAttributeType(arg *NICgetNicSecurityAttributeType, val NICgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isArray +type NICGetSecurityGroupsAttributeType = *[]string +type NICGetSecurityGroupsArgType = []string +type NICGetSecurityGroupsRetType = []string + +func getNICGetSecurityGroupsAttributeTypeOk(arg NICGetSecurityGroupsAttributeType) (ret NICGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetSecurityGroupsAttributeType(arg *NICGetSecurityGroupsAttributeType, val NICGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type NICGetStatusAttributeType = *string + +func getNICGetStatusAttributeTypeOk(arg NICGetStatusAttributeType) (ret NICGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetStatusAttributeType(arg *NICGetStatusAttributeType, val NICGetStatusRetType) { + *arg = &val +} + +type NICGetStatusArgType = string +type NICGetStatusRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type NICGetTypeAttributeType = *string + +func getNICGetTypeAttributeTypeOk(arg NICGetTypeAttributeType) (ret NICGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICGetTypeAttributeType(arg *NICGetTypeAttributeType, val NICGetTypeRetType) { + *arg = &val +} + +type NICGetTypeArgType = string +type NICGetTypeRetType = string + +// NIC Object that represents a network interface. +type NIC struct { + // A list of IPs or CIDR notations. + AllowedAddresses NICGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description NICGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Device NICGetDeviceAttributeType `json:"device,omitempty"` + // Universally Unique Identifier (UUID). + Id NICGetIdAttributeType `json:"id,omitempty"` + // Object that represents an IP address. + Ipv4 NICGetIpv4AttributeType `json:"ipv4,omitempty"` + // String that represents an IPv6 address. + Ipv6 NICGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels NICGetLabelsAttributeType `json:"labels,omitempty"` + // Object that represents an MAC address. + Mac NICGetMacAttributeType `json:"mac,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name NICGetNameAttributeType `json:"name,omitempty"` + // Universally Unique Identifier (UUID). + NetworkId NICGetNetworkIdAttributeType `json:"networkId,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity NICgetNicSecurityAttributeType `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups NICGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // Possible values: `ACTIVE`, `DOWN`. + Status NICGetStatusAttributeType `json:"status,omitempty"` + // Possible values: `server`, `metadata`, `gateway`, `none`. + Type NICGetTypeAttributeType `json:"type,omitempty"` +} + +// NewNIC instantiates a new NIC object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNIC() *NIC { + this := NIC{} + return &this +} + +// NewNICWithDefaults instantiates a new NIC object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNICWithDefaults() *NIC { + this := NIC{} + var nicSecurity bool = true + this.NicSecurity = &nicSecurity + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *NIC) GetAllowedAddresses() (res NICGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetAllowedAddressesOk() (ret NICGetAllowedAddressesRetType, ok bool) { + return getNICGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *NIC) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *NIC) SetAllowedAddresses(v NICGetAllowedAddressesRetType) { + setNICGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *NIC) GetDescription() (res NICGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetDescriptionOk() (ret NICGetDescriptionRetType, ok bool) { + return getNICGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *NIC) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *NIC) SetDescription(v NICGetDescriptionRetType) { + setNICGetDescriptionAttributeType(&o.Description, v) +} + +// GetDevice returns the Device field value if set, zero value otherwise. +func (o *NIC) GetDevice() (res NICGetDeviceRetType) { + res, _ = o.GetDeviceOk() + return +} + +// GetDeviceOk returns a tuple with the Device field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetDeviceOk() (ret NICGetDeviceRetType, ok bool) { + return getNICGetDeviceAttributeTypeOk(o.Device) +} + +// HasDevice returns a boolean if a field has been set. +func (o *NIC) HasDevice() bool { + _, ok := o.GetDeviceOk() + return ok +} + +// SetDevice gets a reference to the given string and assigns it to the Device field. +func (o *NIC) SetDevice(v NICGetDeviceRetType) { + setNICGetDeviceAttributeType(&o.Device, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *NIC) GetId() (res NICGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetIdOk() (ret NICGetIdRetType, ok bool) { + return getNICGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *NIC) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NIC) SetId(v NICGetIdRetType) { + setNICGetIdAttributeType(&o.Id, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *NIC) GetIpv4() (res NICGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetIpv4Ok() (ret NICGetIpv4RetType, ok bool) { + return getNICGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *NIC) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *NIC) SetIpv4(v NICGetIpv4RetType) { + setNICGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *NIC) GetIpv6() (res NICGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetIpv6Ok() (ret NICGetIpv6RetType, ok bool) { + return getNICGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *NIC) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *NIC) SetIpv6(v NICGetIpv6RetType) { + setNICGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *NIC) GetLabels() (res NICGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetLabelsOk() (ret NICGetLabelsRetType, ok bool) { + return getNICGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *NIC) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *NIC) SetLabels(v NICGetLabelsRetType) { + setNICGetLabelsAttributeType(&o.Labels, v) +} + +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *NIC) GetMac() (res NICGetMacRetType) { + res, _ = o.GetMacOk() + return +} + +// GetMacOk returns a tuple with the Mac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetMacOk() (ret NICGetMacRetType, ok bool) { + return getNICGetMacAttributeTypeOk(o.Mac) +} + +// HasMac returns a boolean if a field has been set. +func (o *NIC) HasMac() bool { + _, ok := o.GetMacOk() + return ok +} + +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *NIC) SetMac(v NICGetMacRetType) { + setNICGetMacAttributeType(&o.Mac, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *NIC) GetName() (res NICGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetNameOk() (ret NICGetNameRetType, ok bool) { + return getNICGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *NIC) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *NIC) SetName(v NICGetNameRetType) { + setNICGetNameAttributeType(&o.Name, v) +} + +// GetNetworkId returns the NetworkId field value if set, zero value otherwise. +func (o *NIC) GetNetworkId() (res NICGetNetworkIdRetType) { + res, _ = o.GetNetworkIdOk() + return +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetNetworkIdOk() (ret NICGetNetworkIdRetType, ok bool) { + return getNICGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// HasNetworkId returns a boolean if a field has been set. +func (o *NIC) HasNetworkId() bool { + _, ok := o.GetNetworkIdOk() + return ok +} + +// SetNetworkId gets a reference to the given string and assigns it to the NetworkId field. +func (o *NIC) SetNetworkId(v NICGetNetworkIdRetType) { + setNICGetNetworkIdAttributeType(&o.NetworkId, v) +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *NIC) GetNicSecurity() (res NICgetNicSecurityRetType) { + res, _ = o.GetNicSecurityOk() + return +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetNicSecurityOk() (ret NICgetNicSecurityRetType, ok bool) { + return getNICgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *NIC) HasNicSecurity() bool { + _, ok := o.GetNicSecurityOk() + return ok +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +func (o *NIC) SetNicSecurity(v NICgetNicSecurityRetType) { + setNICgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *NIC) GetSecurityGroups() (res NICGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetSecurityGroupsOk() (ret NICGetSecurityGroupsRetType, ok bool) { + return getNICGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *NIC) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *NIC) SetSecurityGroups(v NICGetSecurityGroupsRetType) { + setNICGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *NIC) GetStatus() (res NICGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetStatusOk() (ret NICGetStatusRetType, ok bool) { + return getNICGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *NIC) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *NIC) SetStatus(v NICGetStatusRetType) { + setNICGetStatusAttributeType(&o.Status, v) +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *NIC) GetType() (res NICGetTypeRetType) { + res, _ = o.GetTypeOk() + return +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NIC) GetTypeOk() (ret NICGetTypeRetType, ok bool) { + return getNICGetTypeAttributeTypeOk(o.Type) +} + +// HasType returns a boolean if a field has been set. +func (o *NIC) HasType() bool { + _, ok := o.GetTypeOk() + return ok +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *NIC) SetType(v NICGetTypeRetType) { + setNICGetTypeAttributeType(&o.Type, v) +} + +func (o NIC) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNICGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getNICGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getNICGetDeviceAttributeTypeOk(o.Device); ok { + toSerialize["Device"] = val + } + if val, ok := getNICGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getNICGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getNICGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getNICGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getNICGetMacAttributeTypeOk(o.Mac); ok { + toSerialize["Mac"] = val + } + if val, ok := getNICGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getNICGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + if val, ok := getNICgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getNICGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getNICGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getNICGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableNIC struct { + value *NIC + isSet bool +} + +func (v NullableNIC) Get() *NIC { + return v.value +} + +func (v *NullableNIC) Set(val *NIC) { + v.value = val + v.isSet = true +} + +func (v NullableNIC) IsSet() bool { + return v.isSet +} + +func (v *NullableNIC) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNIC(val *NIC) *NullableNIC { + return &NullableNIC{value: val, isSet: true} +} + +func (v NullableNIC) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNIC) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nic_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nic_list_response.go new file mode 100644 index 00000000..70d7cab7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_nic_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the NICListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NICListResponse{} + +/* + types and functions for items +*/ + +// isArray +type NICListResponseGetItemsAttributeType = *[]NIC +type NICListResponseGetItemsArgType = []NIC +type NICListResponseGetItemsRetType = []NIC + +func getNICListResponseGetItemsAttributeTypeOk(arg NICListResponseGetItemsAttributeType) (ret NICListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setNICListResponseGetItemsAttributeType(arg *NICListResponseGetItemsAttributeType, val NICListResponseGetItemsRetType) { + *arg = &val +} + +// NICListResponse NIC list response. +type NICListResponse struct { + // A list of network interfaces. + // REQUIRED + Items NICListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _NICListResponse NICListResponse + +// NewNICListResponse instantiates a new NICListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewNICListResponse(items NICListResponseGetItemsArgType) *NICListResponse { + this := NICListResponse{} + setNICListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewNICListResponseWithDefaults instantiates a new NICListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewNICListResponseWithDefaults() *NICListResponse { + this := NICListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *NICListResponse) GetItems() (ret NICListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *NICListResponse) GetItemsOk() (ret NICListResponseGetItemsRetType, ok bool) { + return getNICListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *NICListResponse) SetItems(v NICListResponseGetItemsRetType) { + setNICListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o NICListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getNICListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableNICListResponse struct { + value *NICListResponse + isSet bool +} + +func (v NullableNICListResponse) Get() *NICListResponse { + return v.value +} + +func (v *NullableNICListResponse) Set(val *NICListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableNICListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableNICListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableNICListResponse(val *NICListResponse) *NullableNICListResponse { + return &NullableNICListResponse{value: val, isSet: true} +} + +func (v NullableNICListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableNICListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_partial_update_network_area_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_partial_update_network_area_payload.go new file mode 100644 index 00000000..33e2196b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_partial_update_network_area_payload.go @@ -0,0 +1,176 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PartialUpdateNetworkAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateNetworkAreaPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type PartialUpdateNetworkAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type PartialUpdateNetworkAreaPayloadGetLabelsArgType = map[string]interface{} +type PartialUpdateNetworkAreaPayloadGetLabelsRetType = map[string]interface{} + +func getPartialUpdateNetworkAreaPayloadGetLabelsAttributeTypeOk(arg PartialUpdateNetworkAreaPayloadGetLabelsAttributeType) (ret PartialUpdateNetworkAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkAreaPayloadGetLabelsAttributeType(arg *PartialUpdateNetworkAreaPayloadGetLabelsAttributeType, val PartialUpdateNetworkAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PartialUpdateNetworkAreaPayloadGetNameAttributeType = *string + +func getPartialUpdateNetworkAreaPayloadGetNameAttributeTypeOk(arg PartialUpdateNetworkAreaPayloadGetNameAttributeType) (ret PartialUpdateNetworkAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkAreaPayloadGetNameAttributeType(arg *PartialUpdateNetworkAreaPayloadGetNameAttributeType, val PartialUpdateNetworkAreaPayloadGetNameRetType) { + *arg = &val +} + +type PartialUpdateNetworkAreaPayloadGetNameArgType = string +type PartialUpdateNetworkAreaPayloadGetNameRetType = string + +// PartialUpdateNetworkAreaPayload Object that represents the network area update request. +type PartialUpdateNetworkAreaPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels PartialUpdateNetworkAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + Name PartialUpdateNetworkAreaPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewPartialUpdateNetworkAreaPayload instantiates a new PartialUpdateNetworkAreaPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPartialUpdateNetworkAreaPayload() *PartialUpdateNetworkAreaPayload { + this := PartialUpdateNetworkAreaPayload{} + return &this +} + +// NewPartialUpdateNetworkAreaPayloadWithDefaults instantiates a new PartialUpdateNetworkAreaPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPartialUpdateNetworkAreaPayloadWithDefaults() *PartialUpdateNetworkAreaPayload { + this := PartialUpdateNetworkAreaPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PartialUpdateNetworkAreaPayload) GetLabels() (res PartialUpdateNetworkAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkAreaPayload) GetLabelsOk() (ret PartialUpdateNetworkAreaPayloadGetLabelsRetType, ok bool) { + return getPartialUpdateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *PartialUpdateNetworkAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *PartialUpdateNetworkAreaPayload) SetLabels(v PartialUpdateNetworkAreaPayloadGetLabelsRetType) { + setPartialUpdateNetworkAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateNetworkAreaPayload) GetName() (res PartialUpdateNetworkAreaPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkAreaPayload) GetNameOk() (ret PartialUpdateNetworkAreaPayloadGetNameRetType, ok bool) { + return getPartialUpdateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *PartialUpdateNetworkAreaPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PartialUpdateNetworkAreaPayload) SetName(v PartialUpdateNetworkAreaPayloadGetNameRetType) { + setPartialUpdateNetworkAreaPayloadGetNameAttributeType(&o.Name, v) +} + +func (o PartialUpdateNetworkAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPartialUpdateNetworkAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getPartialUpdateNetworkAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullablePartialUpdateNetworkAreaPayload struct { + value *PartialUpdateNetworkAreaPayload + isSet bool +} + +func (v NullablePartialUpdateNetworkAreaPayload) Get() *PartialUpdateNetworkAreaPayload { + return v.value +} + +func (v *NullablePartialUpdateNetworkAreaPayload) Set(val *PartialUpdateNetworkAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateNetworkAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateNetworkAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateNetworkAreaPayload(val *PartialUpdateNetworkAreaPayload) *NullablePartialUpdateNetworkAreaPayload { + return &NullablePartialUpdateNetworkAreaPayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateNetworkAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateNetworkAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_partial_update_network_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_partial_update_network_payload.go new file mode 100644 index 00000000..83d5321f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_partial_update_network_payload.go @@ -0,0 +1,416 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PartialUpdateNetworkPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PartialUpdateNetworkPayload{} + +/* + types and functions for dhcp +*/ + +// isBoolean +type PartialUpdateNetworkPayloadgetDhcpAttributeType = *bool +type PartialUpdateNetworkPayloadgetDhcpArgType = bool +type PartialUpdateNetworkPayloadgetDhcpRetType = bool + +func getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(arg PartialUpdateNetworkPayloadgetDhcpAttributeType) (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadgetDhcpAttributeType(arg *PartialUpdateNetworkPayloadgetDhcpAttributeType, val PartialUpdateNetworkPayloadgetDhcpRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isModel +type PartialUpdateNetworkPayloadGetIpv4AttributeType = *UpdateNetworkIPv4Body +type PartialUpdateNetworkPayloadGetIpv4ArgType = UpdateNetworkIPv4Body +type PartialUpdateNetworkPayloadGetIpv4RetType = UpdateNetworkIPv4Body + +func getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv4AttributeType) (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetIpv4AttributeType(arg *PartialUpdateNetworkPayloadGetIpv4AttributeType, val PartialUpdateNetworkPayloadGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type PartialUpdateNetworkPayloadGetIpv6AttributeType = *UpdateNetworkIPv6Body +type PartialUpdateNetworkPayloadGetIpv6ArgType = UpdateNetworkIPv6Body +type PartialUpdateNetworkPayloadGetIpv6RetType = UpdateNetworkIPv6Body + +func getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(arg PartialUpdateNetworkPayloadGetIpv6AttributeType) (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetIpv6AttributeType(arg *PartialUpdateNetworkPayloadGetIpv6AttributeType, val PartialUpdateNetworkPayloadGetIpv6RetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type PartialUpdateNetworkPayloadGetLabelsAttributeType = *map[string]interface{} +type PartialUpdateNetworkPayloadGetLabelsArgType = map[string]interface{} +type PartialUpdateNetworkPayloadGetLabelsRetType = map[string]interface{} + +func getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(arg PartialUpdateNetworkPayloadGetLabelsAttributeType) (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetLabelsAttributeType(arg *PartialUpdateNetworkPayloadGetLabelsAttributeType, val PartialUpdateNetworkPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type PartialUpdateNetworkPayloadGetNameAttributeType = *string + +func getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(arg PartialUpdateNetworkPayloadGetNameAttributeType) (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetNameAttributeType(arg *PartialUpdateNetworkPayloadGetNameAttributeType, val PartialUpdateNetworkPayloadGetNameRetType) { + *arg = &val +} + +type PartialUpdateNetworkPayloadGetNameArgType = string +type PartialUpdateNetworkPayloadGetNameRetType = string + +/* + types and functions for routed +*/ + +// isBoolean +type PartialUpdateNetworkPayloadgetRoutedAttributeType = *bool +type PartialUpdateNetworkPayloadgetRoutedArgType = bool +type PartialUpdateNetworkPayloadgetRoutedRetType = bool + +func getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(arg PartialUpdateNetworkPayloadgetRoutedAttributeType) (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadgetRoutedAttributeType(arg *PartialUpdateNetworkPayloadgetRoutedAttributeType, val PartialUpdateNetworkPayloadgetRoutedRetType) { + *arg = &val +} + +/* + types and functions for routingTableId +*/ + +// isNotNullableString +type PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType = *string + +func getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(arg PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType) (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(arg *PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType, val PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + *arg = &val +} + +type PartialUpdateNetworkPayloadGetRoutingTableIdArgType = string +type PartialUpdateNetworkPayloadGetRoutingTableIdRetType = string + +// PartialUpdateNetworkPayload Object that represents the request body for a network update. +type PartialUpdateNetworkPayload struct { + // Enable or disable DHCP for a network. + Dhcp PartialUpdateNetworkPayloadgetDhcpAttributeType `json:"dhcp,omitempty"` + Ipv4 PartialUpdateNetworkPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 PartialUpdateNetworkPayloadGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels PartialUpdateNetworkPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name PartialUpdateNetworkPayloadGetNameAttributeType `json:"name,omitempty"` + // Shows if the network is routed and therefore accessible from other networks. + Routed PartialUpdateNetworkPayloadgetRoutedAttributeType `json:"routed,omitempty"` + // Universally Unique Identifier (UUID). + RoutingTableId PartialUpdateNetworkPayloadGetRoutingTableIdAttributeType `json:"routingTableId,omitempty"` +} + +// NewPartialUpdateNetworkPayload instantiates a new PartialUpdateNetworkPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPartialUpdateNetworkPayload() *PartialUpdateNetworkPayload { + this := PartialUpdateNetworkPayload{} + return &this +} + +// NewPartialUpdateNetworkPayloadWithDefaults instantiates a new PartialUpdateNetworkPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPartialUpdateNetworkPayloadWithDefaults() *PartialUpdateNetworkPayload { + this := PartialUpdateNetworkPayload{} + return &this +} + +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetDhcp() (res PartialUpdateNetworkPayloadgetDhcpRetType) { + res, _ = o.GetDhcpOk() + return +} + +// GetDhcpOk returns a tuple with the Dhcp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetDhcpOk() (ret PartialUpdateNetworkPayloadgetDhcpRetType, ok bool) { + return getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp) +} + +// HasDhcp returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasDhcp() bool { + _, ok := o.GetDhcpOk() + return ok +} + +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *PartialUpdateNetworkPayload) SetDhcp(v PartialUpdateNetworkPayloadgetDhcpRetType) { + setPartialUpdateNetworkPayloadgetDhcpAttributeType(&o.Dhcp, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetIpv4() (res PartialUpdateNetworkPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetIpv4Ok() (ret PartialUpdateNetworkPayloadGetIpv4RetType, ok bool) { + return getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given UpdateNetworkIPv4Body and assigns it to the Ipv4 field. +func (o *PartialUpdateNetworkPayload) SetIpv4(v PartialUpdateNetworkPayloadGetIpv4RetType) { + setPartialUpdateNetworkPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetIpv6() (res PartialUpdateNetworkPayloadGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetIpv6Ok() (ret PartialUpdateNetworkPayloadGetIpv6RetType, ok bool) { + return getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given UpdateNetworkIPv6Body and assigns it to the Ipv6 field. +func (o *PartialUpdateNetworkPayload) SetIpv6(v PartialUpdateNetworkPayloadGetIpv6RetType) { + setPartialUpdateNetworkPayloadGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetLabels() (res PartialUpdateNetworkPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetLabelsOk() (ret PartialUpdateNetworkPayloadGetLabelsRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *PartialUpdateNetworkPayload) SetLabels(v PartialUpdateNetworkPayloadGetLabelsRetType) { + setPartialUpdateNetworkPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetName() (res PartialUpdateNetworkPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetNameOk() (ret PartialUpdateNetworkPayloadGetNameRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PartialUpdateNetworkPayload) SetName(v PartialUpdateNetworkPayloadGetNameRetType) { + setPartialUpdateNetworkPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRouted returns the Routed field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetRouted() (res PartialUpdateNetworkPayloadgetRoutedRetType) { + res, _ = o.GetRoutedOk() + return +} + +// GetRoutedOk returns a tuple with the Routed field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetRoutedOk() (ret PartialUpdateNetworkPayloadgetRoutedRetType, ok bool) { + return getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed) +} + +// HasRouted returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasRouted() bool { + _, ok := o.GetRoutedOk() + return ok +} + +// SetRouted gets a reference to the given bool and assigns it to the Routed field. +func (o *PartialUpdateNetworkPayload) SetRouted(v PartialUpdateNetworkPayloadgetRoutedRetType) { + setPartialUpdateNetworkPayloadgetRoutedAttributeType(&o.Routed, v) +} + +// GetRoutingTableId returns the RoutingTableId field value if set, zero value otherwise. +func (o *PartialUpdateNetworkPayload) GetRoutingTableId() (res PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + res, _ = o.GetRoutingTableIdOk() + return +} + +// GetRoutingTableIdOk returns a tuple with the RoutingTableId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PartialUpdateNetworkPayload) GetRoutingTableIdOk() (ret PartialUpdateNetworkPayloadGetRoutingTableIdRetType, ok bool) { + return getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId) +} + +// HasRoutingTableId returns a boolean if a field has been set. +func (o *PartialUpdateNetworkPayload) HasRoutingTableId() bool { + _, ok := o.GetRoutingTableIdOk() + return ok +} + +// SetRoutingTableId gets a reference to the given string and assigns it to the RoutingTableId field. +func (o *PartialUpdateNetworkPayload) SetRoutingTableId(v PartialUpdateNetworkPayloadGetRoutingTableIdRetType) { + setPartialUpdateNetworkPayloadGetRoutingTableIdAttributeType(&o.RoutingTableId, v) +} + +func (o PartialUpdateNetworkPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPartialUpdateNetworkPayloadgetDhcpAttributeTypeOk(o.Dhcp); ok { + toSerialize["Dhcp"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getPartialUpdateNetworkPayloadgetRoutedAttributeTypeOk(o.Routed); ok { + toSerialize["Routed"] = val + } + if val, ok := getPartialUpdateNetworkPayloadGetRoutingTableIdAttributeTypeOk(o.RoutingTableId); ok { + toSerialize["RoutingTableId"] = val + } + return toSerialize, nil +} + +type NullablePartialUpdateNetworkPayload struct { + value *PartialUpdateNetworkPayload + isSet bool +} + +func (v NullablePartialUpdateNetworkPayload) Get() *PartialUpdateNetworkPayload { + return v.value +} + +func (v *NullablePartialUpdateNetworkPayload) Set(val *PartialUpdateNetworkPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePartialUpdateNetworkPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePartialUpdateNetworkPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePartialUpdateNetworkPayload(val *PartialUpdateNetworkPayload) *NullablePartialUpdateNetworkPayload { + return &NullablePartialUpdateNetworkPayload{value: val, isSet: true} +} + +func (v NullablePartialUpdateNetworkPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePartialUpdateNetworkPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_port_range.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_port_range.go new file mode 100644 index 00000000..ad4f233e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_port_range.go @@ -0,0 +1,170 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PortRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PortRange{} + +/* + types and functions for max +*/ + +// isLong +type PortRangeGetMaxAttributeType = *int64 +type PortRangeGetMaxArgType = int64 +type PortRangeGetMaxRetType = int64 + +func getPortRangeGetMaxAttributeTypeOk(arg PortRangeGetMaxAttributeType) (ret PortRangeGetMaxRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPortRangeGetMaxAttributeType(arg *PortRangeGetMaxAttributeType, val PortRangeGetMaxRetType) { + *arg = &val +} + +/* + types and functions for min +*/ + +// isLong +type PortRangeGetMinAttributeType = *int64 +type PortRangeGetMinArgType = int64 +type PortRangeGetMinRetType = int64 + +func getPortRangeGetMinAttributeTypeOk(arg PortRangeGetMinAttributeType) (ret PortRangeGetMinRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPortRangeGetMinAttributeType(arg *PortRangeGetMinAttributeType, val PortRangeGetMinRetType) { + *arg = &val +} + +// PortRange Object that represents a range of ports. +type PortRange struct { + // The maximum port number. Should be greater or equal to the minimum. + // REQUIRED + Max PortRangeGetMaxAttributeType `json:"max" required:"true"` + // The minimum port number. Should be less or equal to the maximum. + // REQUIRED + Min PortRangeGetMinAttributeType `json:"min" required:"true"` +} + +type _PortRange PortRange + +// NewPortRange instantiates a new PortRange object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPortRange(max PortRangeGetMaxArgType, min PortRangeGetMinArgType) *PortRange { + this := PortRange{} + setPortRangeGetMaxAttributeType(&this.Max, max) + setPortRangeGetMinAttributeType(&this.Min, min) + return &this +} + +// NewPortRangeWithDefaults instantiates a new PortRange object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPortRangeWithDefaults() *PortRange { + this := PortRange{} + return &this +} + +// GetMax returns the Max field value +func (o *PortRange) GetMax() (ret PortRangeGetMaxRetType) { + ret, _ = o.GetMaxOk() + return ret +} + +// GetMaxOk returns a tuple with the Max field value +// and a boolean to check if the value has been set. +func (o *PortRange) GetMaxOk() (ret PortRangeGetMaxRetType, ok bool) { + return getPortRangeGetMaxAttributeTypeOk(o.Max) +} + +// SetMax sets field value +func (o *PortRange) SetMax(v PortRangeGetMaxRetType) { + setPortRangeGetMaxAttributeType(&o.Max, v) +} + +// GetMin returns the Min field value +func (o *PortRange) GetMin() (ret PortRangeGetMinRetType) { + ret, _ = o.GetMinOk() + return ret +} + +// GetMinOk returns a tuple with the Min field value +// and a boolean to check if the value has been set. +func (o *PortRange) GetMinOk() (ret PortRangeGetMinRetType, ok bool) { + return getPortRangeGetMinAttributeTypeOk(o.Min) +} + +// SetMin sets field value +func (o *PortRange) SetMin(v PortRangeGetMinRetType) { + setPortRangeGetMinAttributeType(&o.Min, v) +} + +func (o PortRange) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPortRangeGetMaxAttributeTypeOk(o.Max); ok { + toSerialize["Max"] = val + } + if val, ok := getPortRangeGetMinAttributeTypeOk(o.Min); ok { + toSerialize["Min"] = val + } + return toSerialize, nil +} + +type NullablePortRange struct { + value *PortRange + isSet bool +} + +func (v NullablePortRange) Get() *PortRange { + return v.value +} + +func (v *NullablePortRange) Set(val *PortRange) { + v.value = val + v.isSet = true +} + +func (v NullablePortRange) IsSet() bool { + return v.isSet +} + +func (v *NullablePortRange) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePortRange(val *PortRange) *NullablePortRange { + return &NullablePortRange{value: val, isSet: true} +} + +func (v NullablePortRange) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePortRange) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_project.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_project.go new file mode 100644 index 00000000..e4e42870 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_project.go @@ -0,0 +1,359 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Project type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Project{} + +/* + types and functions for areaId +*/ + +// isModel +type ProjectGetAreaIdAttributeType = *AreaId +type ProjectGetAreaIdArgType = AreaId +type ProjectGetAreaIdRetType = AreaId + +func getProjectGetAreaIdAttributeTypeOk(arg ProjectGetAreaIdAttributeType) (ret ProjectGetAreaIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetAreaIdAttributeType(arg *ProjectGetAreaIdAttributeType, val ProjectGetAreaIdRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ProjectGetCreatedAtAttributeType = *time.Time +type ProjectGetCreatedAtArgType = time.Time +type ProjectGetCreatedAtRetType = time.Time + +func getProjectGetCreatedAtAttributeTypeOk(arg ProjectGetCreatedAtAttributeType) (ret ProjectGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetCreatedAtAttributeType(arg *ProjectGetCreatedAtAttributeType, val ProjectGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type ProjectGetIdAttributeType = *string + +func getProjectGetIdAttributeTypeOk(arg ProjectGetIdAttributeType) (ret ProjectGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetIdAttributeType(arg *ProjectGetIdAttributeType, val ProjectGetIdRetType) { + *arg = &val +} + +type ProjectGetIdArgType = string +type ProjectGetIdRetType = string + +/* + types and functions for internetAccess +*/ + +// isBoolean +type ProjectgetInternetAccessAttributeType = *bool +type ProjectgetInternetAccessArgType = bool +type ProjectgetInternetAccessRetType = bool + +func getProjectgetInternetAccessAttributeTypeOk(arg ProjectgetInternetAccessAttributeType) (ret ProjectgetInternetAccessRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectgetInternetAccessAttributeType(arg *ProjectgetInternetAccessAttributeType, val ProjectgetInternetAccessRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ProjectGetStatusAttributeType = *string + +func getProjectGetStatusAttributeTypeOk(arg ProjectGetStatusAttributeType) (ret ProjectGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetStatusAttributeType(arg *ProjectGetStatusAttributeType, val ProjectGetStatusRetType) { + *arg = &val +} + +type ProjectGetStatusArgType = string +type ProjectGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ProjectGetUpdatedAtAttributeType = *time.Time +type ProjectGetUpdatedAtArgType = time.Time +type ProjectGetUpdatedAtRetType = time.Time + +func getProjectGetUpdatedAtAttributeTypeOk(arg ProjectGetUpdatedAtAttributeType) (ret ProjectGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectGetUpdatedAtAttributeType(arg *ProjectGetUpdatedAtAttributeType, val ProjectGetUpdatedAtRetType) { + *arg = &val +} + +// Project Object that represents a STACKIT project. +type Project struct { + // REQUIRED + AreaId ProjectGetAreaIdAttributeType `json:"areaId" required:"true"` + // Date-time when resource was created. + CreatedAt ProjectGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + Id ProjectGetIdAttributeType `json:"id" required:"true"` + InternetAccess ProjectgetInternetAccessAttributeType `json:"internetAccess,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status ProjectGetStatusAttributeType `json:"status" required:"true"` + // Date-time when resource was last updated. + UpdatedAt ProjectGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Project Project + +// NewProject instantiates a new Project object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProject(areaId ProjectGetAreaIdArgType, id ProjectGetIdArgType, status ProjectGetStatusArgType) *Project { + this := Project{} + setProjectGetAreaIdAttributeType(&this.AreaId, areaId) + setProjectGetIdAttributeType(&this.Id, id) + setProjectGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewProjectWithDefaults instantiates a new Project object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectWithDefaults() *Project { + this := Project{} + return &this +} + +// GetAreaId returns the AreaId field value +func (o *Project) GetAreaId() (ret ProjectGetAreaIdRetType) { + ret, _ = o.GetAreaIdOk() + return ret +} + +// GetAreaIdOk returns a tuple with the AreaId field value +// and a boolean to check if the value has been set. +func (o *Project) GetAreaIdOk() (ret ProjectGetAreaIdRetType, ok bool) { + return getProjectGetAreaIdAttributeTypeOk(o.AreaId) +} + +// SetAreaId sets field value +func (o *Project) SetAreaId(v ProjectGetAreaIdRetType) { + setProjectGetAreaIdAttributeType(&o.AreaId, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Project) GetCreatedAt() (res ProjectGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetCreatedAtOk() (ret ProjectGetCreatedAtRetType, ok bool) { + return getProjectGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Project) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Project) SetCreatedAt(v ProjectGetCreatedAtRetType) { + setProjectGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value +func (o *Project) GetId() (ret ProjectGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Project) GetIdOk() (ret ProjectGetIdRetType, ok bool) { + return getProjectGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *Project) SetId(v ProjectGetIdRetType) { + setProjectGetIdAttributeType(&o.Id, v) +} + +// GetInternetAccess returns the InternetAccess field value if set, zero value otherwise. +func (o *Project) GetInternetAccess() (res ProjectgetInternetAccessRetType) { + res, _ = o.GetInternetAccessOk() + return +} + +// GetInternetAccessOk returns a tuple with the InternetAccess field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetInternetAccessOk() (ret ProjectgetInternetAccessRetType, ok bool) { + return getProjectgetInternetAccessAttributeTypeOk(o.InternetAccess) +} + +// HasInternetAccess returns a boolean if a field has been set. +func (o *Project) HasInternetAccess() bool { + _, ok := o.GetInternetAccessOk() + return ok +} + +// SetInternetAccess gets a reference to the given bool and assigns it to the InternetAccess field. +func (o *Project) SetInternetAccess(v ProjectgetInternetAccessRetType) { + setProjectgetInternetAccessAttributeType(&o.InternetAccess, v) +} + +// GetStatus returns the Status field value +func (o *Project) GetStatus() (ret ProjectGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Project) GetStatusOk() (ret ProjectGetStatusRetType, ok bool) { + return getProjectGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Project) SetStatus(v ProjectGetStatusRetType) { + setProjectGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Project) GetUpdatedAt() (res ProjectGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Project) GetUpdatedAtOk() (ret ProjectGetUpdatedAtRetType, ok bool) { + return getProjectGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Project) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Project) SetUpdatedAt(v ProjectGetUpdatedAtRetType) { + setProjectGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Project) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProjectGetAreaIdAttributeTypeOk(o.AreaId); ok { + toSerialize["AreaId"] = val + } + if val, ok := getProjectGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getProjectGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getProjectgetInternetAccessAttributeTypeOk(o.InternetAccess); ok { + toSerialize["InternetAccess"] = val + } + if val, ok := getProjectGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getProjectGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableProject struct { + value *Project + isSet bool +} + +func (v NullableProject) Get() *Project { + return v.value +} + +func (v *NullableProject) Set(val *Project) { + v.value = val + v.isSet = true +} + +func (v NullableProject) IsSet() bool { + return v.isSet +} + +func (v *NullableProject) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProject(val *Project) *NullableProject { + return &NullableProject{value: val, isSet: true} +} + +func (v NullableProject) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProject) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_project_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_project_list_response.go new file mode 100644 index 00000000..d4192ec0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_project_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ProjectListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProjectListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ProjectListResponseGetItemsAttributeType = *[]string +type ProjectListResponseGetItemsArgType = []string +type ProjectListResponseGetItemsRetType = []string + +func getProjectListResponseGetItemsAttributeTypeOk(arg ProjectListResponseGetItemsAttributeType) (ret ProjectListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProjectListResponseGetItemsAttributeType(arg *ProjectListResponseGetItemsAttributeType, val ProjectListResponseGetItemsRetType) { + *arg = &val +} + +// ProjectListResponse Project list response. +type ProjectListResponse struct { + // A list of STACKIT projects. + // REQUIRED + Items ProjectListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ProjectListResponse ProjectListResponse + +// NewProjectListResponse instantiates a new ProjectListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProjectListResponse(items ProjectListResponseGetItemsArgType) *ProjectListResponse { + this := ProjectListResponse{} + setProjectListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewProjectListResponseWithDefaults instantiates a new ProjectListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProjectListResponseWithDefaults() *ProjectListResponse { + this := ProjectListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ProjectListResponse) GetItems() (ret ProjectListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ProjectListResponse) GetItemsOk() (ret ProjectListResponseGetItemsRetType, ok bool) { + return getProjectListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ProjectListResponse) SetItems(v ProjectListResponseGetItemsRetType) { + setProjectListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ProjectListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProjectListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableProjectListResponse struct { + value *ProjectListResponse + isSet bool +} + +func (v NullableProjectListResponse) Get() *ProjectListResponse { + return v.value +} + +func (v *NullableProjectListResponse) Set(val *ProjectListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableProjectListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableProjectListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProjectListResponse(val *ProjectListResponse) *NullableProjectListResponse { + return &NullableProjectListResponse{value: val, isSet: true} +} + +func (v NullableProjectListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProjectListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_protocol.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_protocol.go new file mode 100644 index 00000000..ee516de5 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_protocol.go @@ -0,0 +1,177 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the Protocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Protocol{} + +/* + types and functions for name +*/ + +// isNotNullableString +type ProtocolGetNameAttributeType = *string + +func getProtocolGetNameAttributeTypeOk(arg ProtocolGetNameAttributeType) (ret ProtocolGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProtocolGetNameAttributeType(arg *ProtocolGetNameAttributeType, val ProtocolGetNameRetType) { + *arg = &val +} + +type ProtocolGetNameArgType = string +type ProtocolGetNameRetType = string + +/* + types and functions for number +*/ + +// isLong +type ProtocolGetNumberAttributeType = *int64 +type ProtocolGetNumberArgType = int64 +type ProtocolGetNumberRetType = int64 + +func getProtocolGetNumberAttributeTypeOk(arg ProtocolGetNumberAttributeType) (ret ProtocolGetNumberRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setProtocolGetNumberAttributeType(arg *ProtocolGetNumberAttributeType, val ProtocolGetNumberRetType) { + *arg = &val +} + +// Protocol The schema for a protocol of a security group rule. +type Protocol struct { + // The protocol name which the rule should match. Possible values: `ah`, `dccp`, `egp`, `esp`, `gre`, `icmp`, `igmp`, `ipip`, `ipv6-encap`, `ipv6-frag`, `ipv6-icmp`, `ipv6-nonxt`, `ipv6-opts`, `ipv6-route`, `ospf`, `pgm`, `rsvp`, `sctp`, `tcp`, `udp`, `udplite`, `vrrp`. + Name ProtocolGetNameAttributeType `json:"name,omitempty"` + // The protocol number which the rule should match. + Number ProtocolGetNumberAttributeType `json:"number,omitempty"` +} + +// NewProtocol instantiates a new Protocol object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewProtocol() *Protocol { + this := Protocol{} + return &this +} + +// NewProtocolWithDefaults instantiates a new Protocol object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewProtocolWithDefaults() *Protocol { + this := Protocol{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Protocol) GetName() (res ProtocolGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Protocol) GetNameOk() (ret ProtocolGetNameRetType, ok bool) { + return getProtocolGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Protocol) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Protocol) SetName(v ProtocolGetNameRetType) { + setProtocolGetNameAttributeType(&o.Name, v) +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *Protocol) GetNumber() (res ProtocolGetNumberRetType) { + res, _ = o.GetNumberOk() + return +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Protocol) GetNumberOk() (ret ProtocolGetNumberRetType, ok bool) { + return getProtocolGetNumberAttributeTypeOk(o.Number) +} + +// HasNumber returns a boolean if a field has been set. +func (o *Protocol) HasNumber() bool { + _, ok := o.GetNumberOk() + return ok +} + +// SetNumber gets a reference to the given int64 and assigns it to the Number field. +func (o *Protocol) SetNumber(v ProtocolGetNumberRetType) { + setProtocolGetNumberAttributeType(&o.Number, v) +} + +func (o Protocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getProtocolGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getProtocolGetNumberAttributeTypeOk(o.Number); ok { + toSerialize["Number"] = val + } + return toSerialize, nil +} + +type NullableProtocol struct { + value *Protocol + isSet bool +} + +func (v NullableProtocol) Get() *Protocol { + return v.value +} + +func (v *NullableProtocol) Set(val *Protocol) { + v.value = val + v.isSet = true +} + +func (v NullableProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtocol(val *Protocol) *NullableProtocol { + return &NullableProtocol{value: val, isSet: true} +} + +func (v NullableProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_ip.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_ip.go new file mode 100644 index 00000000..023387e5 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_ip.go @@ -0,0 +1,290 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicIp type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicIp{} + +/* + types and functions for id +*/ + +// isNotNullableString +type PublicIpGetIdAttributeType = *string + +func getPublicIpGetIdAttributeTypeOk(arg PublicIpGetIdAttributeType) (ret PublicIpGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpGetIdAttributeType(arg *PublicIpGetIdAttributeType, val PublicIpGetIdRetType) { + *arg = &val +} + +type PublicIpGetIdArgType = string +type PublicIpGetIdRetType = string + +/* + types and functions for ip +*/ + +// isNotNullableString +type PublicIpGetIpAttributeType = *string + +func getPublicIpGetIpAttributeTypeOk(arg PublicIpGetIpAttributeType) (ret PublicIpGetIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpGetIpAttributeType(arg *PublicIpGetIpAttributeType, val PublicIpGetIpRetType) { + *arg = &val +} + +type PublicIpGetIpArgType = string +type PublicIpGetIpRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type PublicIpGetLabelsAttributeType = *map[string]interface{} +type PublicIpGetLabelsArgType = map[string]interface{} +type PublicIpGetLabelsRetType = map[string]interface{} + +func getPublicIpGetLabelsAttributeTypeOk(arg PublicIpGetLabelsAttributeType) (ret PublicIpGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpGetLabelsAttributeType(arg *PublicIpGetLabelsAttributeType, val PublicIpGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for networkInterface +*/ + +// isNullableString +type PublicIpGetNetworkInterfaceAttributeType = *NullableString + +func getPublicIpGetNetworkInterfaceAttributeTypeOk(arg PublicIpGetNetworkInterfaceAttributeType) (ret PublicIpGetNetworkInterfaceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setPublicIpGetNetworkInterfaceAttributeType(arg *PublicIpGetNetworkInterfaceAttributeType, val PublicIpGetNetworkInterfaceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type PublicIpGetNetworkInterfaceArgType = *string +type PublicIpGetNetworkInterfaceRetType = *string + +// PublicIp Object that represents a public IP. +type PublicIp struct { + // Universally Unique Identifier (UUID). + Id PublicIpGetIdAttributeType `json:"id,omitempty"` + // String that represents an IPv4 address. + Ip PublicIpGetIpAttributeType `json:"ip,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels PublicIpGetLabelsAttributeType `json:"labels,omitempty"` + // Universally Unique Identifier (UUID). + NetworkInterface PublicIpGetNetworkInterfaceAttributeType `json:"networkInterface,omitempty"` +} + +// NewPublicIp instantiates a new PublicIp object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPublicIp() *PublicIp { + this := PublicIp{} + return &this +} + +// NewPublicIpWithDefaults instantiates a new PublicIp object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPublicIpWithDefaults() *PublicIp { + this := PublicIp{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *PublicIp) GetId() (res PublicIpGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PublicIp) GetIdOk() (ret PublicIpGetIdRetType, ok bool) { + return getPublicIpGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *PublicIp) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PublicIp) SetId(v PublicIpGetIdRetType) { + setPublicIpGetIdAttributeType(&o.Id, v) +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *PublicIp) GetIp() (res PublicIpGetIpRetType) { + res, _ = o.GetIpOk() + return +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PublicIp) GetIpOk() (ret PublicIpGetIpRetType, ok bool) { + return getPublicIpGetIpAttributeTypeOk(o.Ip) +} + +// HasIp returns a boolean if a field has been set. +func (o *PublicIp) HasIp() bool { + _, ok := o.GetIpOk() + return ok +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *PublicIp) SetIp(v PublicIpGetIpRetType) { + setPublicIpGetIpAttributeType(&o.Ip, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PublicIp) GetLabels() (res PublicIpGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PublicIp) GetLabelsOk() (ret PublicIpGetLabelsRetType, ok bool) { + return getPublicIpGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *PublicIp) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *PublicIp) SetLabels(v PublicIpGetLabelsRetType) { + setPublicIpGetLabelsAttributeType(&o.Labels, v) +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *PublicIp) GetNetworkInterface() (res PublicIpGetNetworkInterfaceRetType) { + res, _ = o.GetNetworkInterfaceOk() + return +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *PublicIp) GetNetworkInterfaceOk() (ret PublicIpGetNetworkInterfaceRetType, ok bool) { + return getPublicIpGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface) +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *PublicIp) HasNetworkInterface() bool { + _, ok := o.GetNetworkInterfaceOk() + return ok +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *PublicIp) SetNetworkInterface(v PublicIpGetNetworkInterfaceRetType) { + setPublicIpGetNetworkInterfaceAttributeType(&o.NetworkInterface, v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *PublicIp) SetNetworkInterfaceNil() { + o.NetworkInterface = nil +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *PublicIp) UnsetNetworkInterface() { + o.NetworkInterface = nil +} + +func (o PublicIp) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicIpGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getPublicIpGetIpAttributeTypeOk(o.Ip); ok { + toSerialize["Ip"] = val + } + if val, ok := getPublicIpGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getPublicIpGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface); ok { + toSerialize["NetworkInterface"] = val + } + return toSerialize, nil +} + +type NullablePublicIp struct { + value *PublicIp + isSet bool +} + +func (v NullablePublicIp) Get() *PublicIp { + return v.value +} + +func (v *NullablePublicIp) Set(val *PublicIp) { + v.value = val + v.isSet = true +} + +func (v NullablePublicIp) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicIp) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicIp(val *PublicIp) *NullablePublicIp { + return &NullablePublicIp{value: val, isSet: true} +} + +func (v NullablePublicIp) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicIp) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_ip_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_ip_list_response.go new file mode 100644 index 00000000..f0624192 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_ip_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicIpListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicIpListResponse{} + +/* + types and functions for items +*/ + +// isArray +type PublicIpListResponseGetItemsAttributeType = *[]PublicIp +type PublicIpListResponseGetItemsArgType = []PublicIp +type PublicIpListResponseGetItemsRetType = []PublicIp + +func getPublicIpListResponseGetItemsAttributeTypeOk(arg PublicIpListResponseGetItemsAttributeType) (ret PublicIpListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicIpListResponseGetItemsAttributeType(arg *PublicIpListResponseGetItemsAttributeType, val PublicIpListResponseGetItemsRetType) { + *arg = &val +} + +// PublicIpListResponse Public IP list response. +type PublicIpListResponse struct { + // A list of public IPs. + // REQUIRED + Items PublicIpListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _PublicIpListResponse PublicIpListResponse + +// NewPublicIpListResponse instantiates a new PublicIpListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPublicIpListResponse(items PublicIpListResponseGetItemsArgType) *PublicIpListResponse { + this := PublicIpListResponse{} + setPublicIpListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewPublicIpListResponseWithDefaults instantiates a new PublicIpListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPublicIpListResponseWithDefaults() *PublicIpListResponse { + this := PublicIpListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *PublicIpListResponse) GetItems() (ret PublicIpListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *PublicIpListResponse) GetItemsOk() (ret PublicIpListResponseGetItemsRetType, ok bool) { + return getPublicIpListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *PublicIpListResponse) SetItems(v PublicIpListResponseGetItemsRetType) { + setPublicIpListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o PublicIpListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicIpListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullablePublicIpListResponse struct { + value *PublicIpListResponse + isSet bool +} + +func (v NullablePublicIpListResponse) Get() *PublicIpListResponse { + return v.value +} + +func (v *NullablePublicIpListResponse) Set(val *PublicIpListResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePublicIpListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicIpListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicIpListResponse(val *PublicIpListResponse) *NullablePublicIpListResponse { + return &NullablePublicIpListResponse{value: val, isSet: true} +} + +func (v NullablePublicIpListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicIpListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_network.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_network.go new file mode 100644 index 00000000..c84b840e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_network.go @@ -0,0 +1,172 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicNetwork{} + +/* + types and functions for cidr +*/ + +// isNotNullableString +type PublicNetworkGetCidrAttributeType = *string + +func getPublicNetworkGetCidrAttributeTypeOk(arg PublicNetworkGetCidrAttributeType) (ret PublicNetworkGetCidrRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicNetworkGetCidrAttributeType(arg *PublicNetworkGetCidrAttributeType, val PublicNetworkGetCidrRetType) { + *arg = &val +} + +type PublicNetworkGetCidrArgType = string +type PublicNetworkGetCidrRetType = string + +/* + types and functions for region +*/ + +// isNotNullableString +type PublicNetworkGetRegionAttributeType = *string + +func getPublicNetworkGetRegionAttributeTypeOk(arg PublicNetworkGetRegionAttributeType) (ret PublicNetworkGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicNetworkGetRegionAttributeType(arg *PublicNetworkGetRegionAttributeType, val PublicNetworkGetRegionRetType) { + *arg = &val +} + +type PublicNetworkGetRegionArgType = string +type PublicNetworkGetRegionRetType = string + +// PublicNetwork Public network. +type PublicNetwork struct { + // Classless Inter-Domain Routing (CIDR). + // REQUIRED + Cidr PublicNetworkGetCidrAttributeType `json:"cidr" required:"true"` + // Name of the region. + // REQUIRED + Region PublicNetworkGetRegionAttributeType `json:"region" required:"true"` +} + +type _PublicNetwork PublicNetwork + +// NewPublicNetwork instantiates a new PublicNetwork object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPublicNetwork(cidr PublicNetworkGetCidrArgType, region PublicNetworkGetRegionArgType) *PublicNetwork { + this := PublicNetwork{} + setPublicNetworkGetCidrAttributeType(&this.Cidr, cidr) + setPublicNetworkGetRegionAttributeType(&this.Region, region) + return &this +} + +// NewPublicNetworkWithDefaults instantiates a new PublicNetwork object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPublicNetworkWithDefaults() *PublicNetwork { + this := PublicNetwork{} + return &this +} + +// GetCidr returns the Cidr field value +func (o *PublicNetwork) GetCidr() (ret PublicNetworkGetCidrRetType) { + ret, _ = o.GetCidrOk() + return ret +} + +// GetCidrOk returns a tuple with the Cidr field value +// and a boolean to check if the value has been set. +func (o *PublicNetwork) GetCidrOk() (ret PublicNetworkGetCidrRetType, ok bool) { + return getPublicNetworkGetCidrAttributeTypeOk(o.Cidr) +} + +// SetCidr sets field value +func (o *PublicNetwork) SetCidr(v PublicNetworkGetCidrRetType) { + setPublicNetworkGetCidrAttributeType(&o.Cidr, v) +} + +// GetRegion returns the Region field value +func (o *PublicNetwork) GetRegion() (ret PublicNetworkGetRegionRetType) { + ret, _ = o.GetRegionOk() + return ret +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *PublicNetwork) GetRegionOk() (ret PublicNetworkGetRegionRetType, ok bool) { + return getPublicNetworkGetRegionAttributeTypeOk(o.Region) +} + +// SetRegion sets field value +func (o *PublicNetwork) SetRegion(v PublicNetworkGetRegionRetType) { + setPublicNetworkGetRegionAttributeType(&o.Region, v) +} + +func (o PublicNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicNetworkGetCidrAttributeTypeOk(o.Cidr); ok { + toSerialize["Cidr"] = val + } + if val, ok := getPublicNetworkGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + return toSerialize, nil +} + +type NullablePublicNetwork struct { + value *PublicNetwork + isSet bool +} + +func (v NullablePublicNetwork) Get() *PublicNetwork { + return v.value +} + +func (v *NullablePublicNetwork) Set(val *PublicNetwork) { + v.value = val + v.isSet = true +} + +func (v NullablePublicNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicNetwork(val *PublicNetwork) *NullablePublicNetwork { + return &NullablePublicNetwork{value: val, isSet: true} +} + +func (v NullablePublicNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_network_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_network_list_response.go new file mode 100644 index 00000000..db106788 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_public_network_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicNetworkListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicNetworkListResponse{} + +/* + types and functions for items +*/ + +// isArray +type PublicNetworkListResponseGetItemsAttributeType = *[]PublicNetwork +type PublicNetworkListResponseGetItemsArgType = []PublicNetwork +type PublicNetworkListResponseGetItemsRetType = []PublicNetwork + +func getPublicNetworkListResponseGetItemsAttributeTypeOk(arg PublicNetworkListResponseGetItemsAttributeType) (ret PublicNetworkListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setPublicNetworkListResponseGetItemsAttributeType(arg *PublicNetworkListResponseGetItemsAttributeType, val PublicNetworkListResponseGetItemsRetType) { + *arg = &val +} + +// PublicNetworkListResponse Public network list response. +type PublicNetworkListResponse struct { + // A list of public networks. + // REQUIRED + Items PublicNetworkListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _PublicNetworkListResponse PublicNetworkListResponse + +// NewPublicNetworkListResponse instantiates a new PublicNetworkListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewPublicNetworkListResponse(items PublicNetworkListResponseGetItemsArgType) *PublicNetworkListResponse { + this := PublicNetworkListResponse{} + setPublicNetworkListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewPublicNetworkListResponseWithDefaults instantiates a new PublicNetworkListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewPublicNetworkListResponseWithDefaults() *PublicNetworkListResponse { + this := PublicNetworkListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *PublicNetworkListResponse) GetItems() (ret PublicNetworkListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *PublicNetworkListResponse) GetItemsOk() (ret PublicNetworkListResponseGetItemsRetType, ok bool) { + return getPublicNetworkListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *PublicNetworkListResponse) SetItems(v PublicNetworkListResponseGetItemsRetType) { + setPublicNetworkListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o PublicNetworkListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getPublicNetworkListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullablePublicNetworkListResponse struct { + value *PublicNetworkListResponse + isSet bool +} + +func (v NullablePublicNetworkListResponse) Get() *PublicNetworkListResponse { + return v.value +} + +func (v *NullablePublicNetworkListResponse) Set(val *PublicNetworkListResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePublicNetworkListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicNetworkListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicNetworkListResponse(val *PublicNetworkListResponse) *NullablePublicNetworkListResponse { + return &NullablePublicNetworkListResponse{value: val, isSet: true} +} + +func (v NullablePublicNetworkListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicNetworkListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota.go new file mode 100644 index 00000000..b1b82258 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the Quota type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Quota{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaGetLimitAttributeType = *int64 +type QuotaGetLimitArgType = int64 +type QuotaGetLimitRetType = int64 + +func getQuotaGetLimitAttributeTypeOk(arg QuotaGetLimitAttributeType) (ret QuotaGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaGetLimitAttributeType(arg *QuotaGetLimitAttributeType, val QuotaGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaGetUsageAttributeType = *int64 +type QuotaGetUsageArgType = int64 +type QuotaGetUsageRetType = int64 + +func getQuotaGetUsageAttributeTypeOk(arg QuotaGetUsageAttributeType) (ret QuotaGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaGetUsageAttributeType(arg *QuotaGetUsageAttributeType, val QuotaGetUsageRetType) { + *arg = &val +} + +// Quota Object that represents a single resource quota. +type Quota struct { + // REQUIRED + Limit QuotaGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaGetUsageAttributeType `json:"usage" required:"true"` +} + +type _Quota Quota + +// NewQuota instantiates a new Quota object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuota(limit QuotaGetLimitArgType, usage QuotaGetUsageArgType) *Quota { + this := Quota{} + setQuotaGetLimitAttributeType(&this.Limit, limit) + setQuotaGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaWithDefaults instantiates a new Quota object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaWithDefaults() *Quota { + this := Quota{} + return &this +} + +// GetLimit returns the Limit field value +func (o *Quota) GetLimit() (ret QuotaGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *Quota) GetLimitOk() (ret QuotaGetLimitRetType, ok bool) { + return getQuotaGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *Quota) SetLimit(v QuotaGetLimitRetType) { + setQuotaGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *Quota) GetUsage() (ret QuotaGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *Quota) GetUsageOk() (ret QuotaGetUsageRetType, ok bool) { + return getQuotaGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *Quota) SetUsage(v QuotaGetUsageRetType) { + setQuotaGetUsageAttributeType(&o.Usage, v) +} + +func (o Quota) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuota struct { + value *Quota + isSet bool +} + +func (v NullableQuota) Get() *Quota { + return v.value +} + +func (v *NullableQuota) Set(val *Quota) { + v.value = val + v.isSet = true +} + +func (v NullableQuota) IsSet() bool { + return v.isSet +} + +func (v *NullableQuota) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuota(val *Quota) *NullableQuota { + return &NullableQuota{value: val, isSet: true} +} + +func (v NullableQuota) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuota) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list.go new file mode 100644 index 00000000..571365b7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list.go @@ -0,0 +1,598 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaList{} + +/* + types and functions for backupGigabytes +*/ + +// isModel +type QuotaListGetBackupGigabytesAttributeType = *QuotaListBackupGigabytes +type QuotaListGetBackupGigabytesArgType = QuotaListBackupGigabytes +type QuotaListGetBackupGigabytesRetType = QuotaListBackupGigabytes + +func getQuotaListGetBackupGigabytesAttributeTypeOk(arg QuotaListGetBackupGigabytesAttributeType) (ret QuotaListGetBackupGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetBackupGigabytesAttributeType(arg *QuotaListGetBackupGigabytesAttributeType, val QuotaListGetBackupGigabytesRetType) { + *arg = &val +} + +/* + types and functions for backups +*/ + +// isModel +type QuotaListGetBackupsAttributeType = *QuotaListBackups +type QuotaListGetBackupsArgType = QuotaListBackups +type QuotaListGetBackupsRetType = QuotaListBackups + +func getQuotaListGetBackupsAttributeTypeOk(arg QuotaListGetBackupsAttributeType) (ret QuotaListGetBackupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetBackupsAttributeType(arg *QuotaListGetBackupsAttributeType, val QuotaListGetBackupsRetType) { + *arg = &val +} + +/* + types and functions for gigabytes +*/ + +// isModel +type QuotaListGetGigabytesAttributeType = *QuotaListGigabytes +type QuotaListGetGigabytesArgType = QuotaListGigabytes +type QuotaListGetGigabytesRetType = QuotaListGigabytes + +func getQuotaListGetGigabytesAttributeTypeOk(arg QuotaListGetGigabytesAttributeType) (ret QuotaListGetGigabytesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetGigabytesAttributeType(arg *QuotaListGetGigabytesAttributeType, val QuotaListGetGigabytesRetType) { + *arg = &val +} + +/* + types and functions for networks +*/ + +// isModel +type QuotaListGetNetworksAttributeType = *QuotaListNetworks +type QuotaListGetNetworksArgType = QuotaListNetworks +type QuotaListGetNetworksRetType = QuotaListNetworks + +func getQuotaListGetNetworksAttributeTypeOk(arg QuotaListGetNetworksAttributeType) (ret QuotaListGetNetworksRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetNetworksAttributeType(arg *QuotaListGetNetworksAttributeType, val QuotaListGetNetworksRetType) { + *arg = &val +} + +/* + types and functions for nics +*/ + +// isModel +type QuotaListGetNicsAttributeType = *QuotaListNics +type QuotaListGetNicsArgType = QuotaListNics +type QuotaListGetNicsRetType = QuotaListNics + +func getQuotaListGetNicsAttributeTypeOk(arg QuotaListGetNicsAttributeType) (ret QuotaListGetNicsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetNicsAttributeType(arg *QuotaListGetNicsAttributeType, val QuotaListGetNicsRetType) { + *arg = &val +} + +/* + types and functions for publicIps +*/ + +// isModel +type QuotaListGetPublicIpsAttributeType = *QuotaListPublicIps +type QuotaListGetPublicIpsArgType = QuotaListPublicIps +type QuotaListGetPublicIpsRetType = QuotaListPublicIps + +func getQuotaListGetPublicIpsAttributeTypeOk(arg QuotaListGetPublicIpsAttributeType) (ret QuotaListGetPublicIpsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetPublicIpsAttributeType(arg *QuotaListGetPublicIpsAttributeType, val QuotaListGetPublicIpsRetType) { + *arg = &val +} + +/* + types and functions for ram +*/ + +// isModel +type QuotaListGetRamAttributeType = *QuotaListRam +type QuotaListGetRamArgType = QuotaListRam +type QuotaListGetRamRetType = QuotaListRam + +func getQuotaListGetRamAttributeTypeOk(arg QuotaListGetRamAttributeType) (ret QuotaListGetRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetRamAttributeType(arg *QuotaListGetRamAttributeType, val QuotaListGetRamRetType) { + *arg = &val +} + +/* + types and functions for securityGroupRules +*/ + +// isModel +type QuotaListGetSecurityGroupRulesAttributeType = *QuotaListSecurityGroupRules +type QuotaListGetSecurityGroupRulesArgType = QuotaListSecurityGroupRules +type QuotaListGetSecurityGroupRulesRetType = QuotaListSecurityGroupRules + +func getQuotaListGetSecurityGroupRulesAttributeTypeOk(arg QuotaListGetSecurityGroupRulesAttributeType) (ret QuotaListGetSecurityGroupRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetSecurityGroupRulesAttributeType(arg *QuotaListGetSecurityGroupRulesAttributeType, val QuotaListGetSecurityGroupRulesRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isModel +type QuotaListGetSecurityGroupsAttributeType = *QuotaListSecurityGroups +type QuotaListGetSecurityGroupsArgType = QuotaListSecurityGroups +type QuotaListGetSecurityGroupsRetType = QuotaListSecurityGroups + +func getQuotaListGetSecurityGroupsAttributeTypeOk(arg QuotaListGetSecurityGroupsAttributeType) (ret QuotaListGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetSecurityGroupsAttributeType(arg *QuotaListGetSecurityGroupsAttributeType, val QuotaListGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for snapshots +*/ + +// isModel +type QuotaListGetSnapshotsAttributeType = *QuotaListSnapshots +type QuotaListGetSnapshotsArgType = QuotaListSnapshots +type QuotaListGetSnapshotsRetType = QuotaListSnapshots + +func getQuotaListGetSnapshotsAttributeTypeOk(arg QuotaListGetSnapshotsAttributeType) (ret QuotaListGetSnapshotsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetSnapshotsAttributeType(arg *QuotaListGetSnapshotsAttributeType, val QuotaListGetSnapshotsRetType) { + *arg = &val +} + +/* + types and functions for vcpu +*/ + +// isModel +type QuotaListGetVcpuAttributeType = *QuotaListVcpu +type QuotaListGetVcpuArgType = QuotaListVcpu +type QuotaListGetVcpuRetType = QuotaListVcpu + +func getQuotaListGetVcpuAttributeTypeOk(arg QuotaListGetVcpuAttributeType) (ret QuotaListGetVcpuRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetVcpuAttributeType(arg *QuotaListGetVcpuAttributeType, val QuotaListGetVcpuRetType) { + *arg = &val +} + +/* + types and functions for volumes +*/ + +// isModel +type QuotaListGetVolumesAttributeType = *QuotaListVolumes +type QuotaListGetVolumesArgType = QuotaListVolumes +type QuotaListGetVolumesRetType = QuotaListVolumes + +func getQuotaListGetVolumesAttributeTypeOk(arg QuotaListGetVolumesAttributeType) (ret QuotaListGetVolumesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGetVolumesAttributeType(arg *QuotaListGetVolumesAttributeType, val QuotaListGetVolumesRetType) { + *arg = &val +} + +// QuotaList Object that represents the quotas for a project. +type QuotaList struct { + // REQUIRED + BackupGigabytes QuotaListGetBackupGigabytesAttributeType `json:"backupGigabytes" required:"true"` + // REQUIRED + Backups QuotaListGetBackupsAttributeType `json:"backups" required:"true"` + // REQUIRED + Gigabytes QuotaListGetGigabytesAttributeType `json:"gigabytes" required:"true"` + // REQUIRED + Networks QuotaListGetNetworksAttributeType `json:"networks" required:"true"` + // REQUIRED + Nics QuotaListGetNicsAttributeType `json:"nics" required:"true"` + // REQUIRED + PublicIps QuotaListGetPublicIpsAttributeType `json:"publicIps" required:"true"` + // REQUIRED + Ram QuotaListGetRamAttributeType `json:"ram" required:"true"` + // REQUIRED + SecurityGroupRules QuotaListGetSecurityGroupRulesAttributeType `json:"securityGroupRules" required:"true"` + // REQUIRED + SecurityGroups QuotaListGetSecurityGroupsAttributeType `json:"securityGroups" required:"true"` + // REQUIRED + Snapshots QuotaListGetSnapshotsAttributeType `json:"snapshots" required:"true"` + // REQUIRED + Vcpu QuotaListGetVcpuAttributeType `json:"vcpu" required:"true"` + // REQUIRED + Volumes QuotaListGetVolumesAttributeType `json:"volumes" required:"true"` +} + +type _QuotaList QuotaList + +// NewQuotaList instantiates a new QuotaList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaList(backupGigabytes QuotaListGetBackupGigabytesArgType, backups QuotaListGetBackupsArgType, gigabytes QuotaListGetGigabytesArgType, networks QuotaListGetNetworksArgType, nics QuotaListGetNicsArgType, publicIps QuotaListGetPublicIpsArgType, ram QuotaListGetRamArgType, securityGroupRules QuotaListGetSecurityGroupRulesArgType, securityGroups QuotaListGetSecurityGroupsArgType, snapshots QuotaListGetSnapshotsArgType, vcpu QuotaListGetVcpuArgType, volumes QuotaListGetVolumesArgType) *QuotaList { + this := QuotaList{} + setQuotaListGetBackupGigabytesAttributeType(&this.BackupGigabytes, backupGigabytes) + setQuotaListGetBackupsAttributeType(&this.Backups, backups) + setQuotaListGetGigabytesAttributeType(&this.Gigabytes, gigabytes) + setQuotaListGetNetworksAttributeType(&this.Networks, networks) + setQuotaListGetNicsAttributeType(&this.Nics, nics) + setQuotaListGetPublicIpsAttributeType(&this.PublicIps, publicIps) + setQuotaListGetRamAttributeType(&this.Ram, ram) + setQuotaListGetSecurityGroupRulesAttributeType(&this.SecurityGroupRules, securityGroupRules) + setQuotaListGetSecurityGroupsAttributeType(&this.SecurityGroups, securityGroups) + setQuotaListGetSnapshotsAttributeType(&this.Snapshots, snapshots) + setQuotaListGetVcpuAttributeType(&this.Vcpu, vcpu) + setQuotaListGetVolumesAttributeType(&this.Volumes, volumes) + return &this +} + +// NewQuotaListWithDefaults instantiates a new QuotaList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListWithDefaults() *QuotaList { + this := QuotaList{} + return &this +} + +// GetBackupGigabytes returns the BackupGigabytes field value +func (o *QuotaList) GetBackupGigabytes() (ret QuotaListGetBackupGigabytesRetType) { + ret, _ = o.GetBackupGigabytesOk() + return ret +} + +// GetBackupGigabytesOk returns a tuple with the BackupGigabytes field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetBackupGigabytesOk() (ret QuotaListGetBackupGigabytesRetType, ok bool) { + return getQuotaListGetBackupGigabytesAttributeTypeOk(o.BackupGigabytes) +} + +// SetBackupGigabytes sets field value +func (o *QuotaList) SetBackupGigabytes(v QuotaListGetBackupGigabytesRetType) { + setQuotaListGetBackupGigabytesAttributeType(&o.BackupGigabytes, v) +} + +// GetBackups returns the Backups field value +func (o *QuotaList) GetBackups() (ret QuotaListGetBackupsRetType) { + ret, _ = o.GetBackupsOk() + return ret +} + +// GetBackupsOk returns a tuple with the Backups field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetBackupsOk() (ret QuotaListGetBackupsRetType, ok bool) { + return getQuotaListGetBackupsAttributeTypeOk(o.Backups) +} + +// SetBackups sets field value +func (o *QuotaList) SetBackups(v QuotaListGetBackupsRetType) { + setQuotaListGetBackupsAttributeType(&o.Backups, v) +} + +// GetGigabytes returns the Gigabytes field value +func (o *QuotaList) GetGigabytes() (ret QuotaListGetGigabytesRetType) { + ret, _ = o.GetGigabytesOk() + return ret +} + +// GetGigabytesOk returns a tuple with the Gigabytes field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetGigabytesOk() (ret QuotaListGetGigabytesRetType, ok bool) { + return getQuotaListGetGigabytesAttributeTypeOk(o.Gigabytes) +} + +// SetGigabytes sets field value +func (o *QuotaList) SetGigabytes(v QuotaListGetGigabytesRetType) { + setQuotaListGetGigabytesAttributeType(&o.Gigabytes, v) +} + +// GetNetworks returns the Networks field value +func (o *QuotaList) GetNetworks() (ret QuotaListGetNetworksRetType) { + ret, _ = o.GetNetworksOk() + return ret +} + +// GetNetworksOk returns a tuple with the Networks field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetNetworksOk() (ret QuotaListGetNetworksRetType, ok bool) { + return getQuotaListGetNetworksAttributeTypeOk(o.Networks) +} + +// SetNetworks sets field value +func (o *QuotaList) SetNetworks(v QuotaListGetNetworksRetType) { + setQuotaListGetNetworksAttributeType(&o.Networks, v) +} + +// GetNics returns the Nics field value +func (o *QuotaList) GetNics() (ret QuotaListGetNicsRetType) { + ret, _ = o.GetNicsOk() + return ret +} + +// GetNicsOk returns a tuple with the Nics field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetNicsOk() (ret QuotaListGetNicsRetType, ok bool) { + return getQuotaListGetNicsAttributeTypeOk(o.Nics) +} + +// SetNics sets field value +func (o *QuotaList) SetNics(v QuotaListGetNicsRetType) { + setQuotaListGetNicsAttributeType(&o.Nics, v) +} + +// GetPublicIps returns the PublicIps field value +func (o *QuotaList) GetPublicIps() (ret QuotaListGetPublicIpsRetType) { + ret, _ = o.GetPublicIpsOk() + return ret +} + +// GetPublicIpsOk returns a tuple with the PublicIps field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetPublicIpsOk() (ret QuotaListGetPublicIpsRetType, ok bool) { + return getQuotaListGetPublicIpsAttributeTypeOk(o.PublicIps) +} + +// SetPublicIps sets field value +func (o *QuotaList) SetPublicIps(v QuotaListGetPublicIpsRetType) { + setQuotaListGetPublicIpsAttributeType(&o.PublicIps, v) +} + +// GetRam returns the Ram field value +func (o *QuotaList) GetRam() (ret QuotaListGetRamRetType) { + ret, _ = o.GetRamOk() + return ret +} + +// GetRamOk returns a tuple with the Ram field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetRamOk() (ret QuotaListGetRamRetType, ok bool) { + return getQuotaListGetRamAttributeTypeOk(o.Ram) +} + +// SetRam sets field value +func (o *QuotaList) SetRam(v QuotaListGetRamRetType) { + setQuotaListGetRamAttributeType(&o.Ram, v) +} + +// GetSecurityGroupRules returns the SecurityGroupRules field value +func (o *QuotaList) GetSecurityGroupRules() (ret QuotaListGetSecurityGroupRulesRetType) { + ret, _ = o.GetSecurityGroupRulesOk() + return ret +} + +// GetSecurityGroupRulesOk returns a tuple with the SecurityGroupRules field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetSecurityGroupRulesOk() (ret QuotaListGetSecurityGroupRulesRetType, ok bool) { + return getQuotaListGetSecurityGroupRulesAttributeTypeOk(o.SecurityGroupRules) +} + +// SetSecurityGroupRules sets field value +func (o *QuotaList) SetSecurityGroupRules(v QuotaListGetSecurityGroupRulesRetType) { + setQuotaListGetSecurityGroupRulesAttributeType(&o.SecurityGroupRules, v) +} + +// GetSecurityGroups returns the SecurityGroups field value +func (o *QuotaList) GetSecurityGroups() (ret QuotaListGetSecurityGroupsRetType) { + ret, _ = o.GetSecurityGroupsOk() + return ret +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetSecurityGroupsOk() (ret QuotaListGetSecurityGroupsRetType, ok bool) { + return getQuotaListGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// SetSecurityGroups sets field value +func (o *QuotaList) SetSecurityGroups(v QuotaListGetSecurityGroupsRetType) { + setQuotaListGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetSnapshots returns the Snapshots field value +func (o *QuotaList) GetSnapshots() (ret QuotaListGetSnapshotsRetType) { + ret, _ = o.GetSnapshotsOk() + return ret +} + +// GetSnapshotsOk returns a tuple with the Snapshots field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetSnapshotsOk() (ret QuotaListGetSnapshotsRetType, ok bool) { + return getQuotaListGetSnapshotsAttributeTypeOk(o.Snapshots) +} + +// SetSnapshots sets field value +func (o *QuotaList) SetSnapshots(v QuotaListGetSnapshotsRetType) { + setQuotaListGetSnapshotsAttributeType(&o.Snapshots, v) +} + +// GetVcpu returns the Vcpu field value +func (o *QuotaList) GetVcpu() (ret QuotaListGetVcpuRetType) { + ret, _ = o.GetVcpuOk() + return ret +} + +// GetVcpuOk returns a tuple with the Vcpu field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetVcpuOk() (ret QuotaListGetVcpuRetType, ok bool) { + return getQuotaListGetVcpuAttributeTypeOk(o.Vcpu) +} + +// SetVcpu sets field value +func (o *QuotaList) SetVcpu(v QuotaListGetVcpuRetType) { + setQuotaListGetVcpuAttributeType(&o.Vcpu, v) +} + +// GetVolumes returns the Volumes field value +func (o *QuotaList) GetVolumes() (ret QuotaListGetVolumesRetType) { + ret, _ = o.GetVolumesOk() + return ret +} + +// GetVolumesOk returns a tuple with the Volumes field value +// and a boolean to check if the value has been set. +func (o *QuotaList) GetVolumesOk() (ret QuotaListGetVolumesRetType, ok bool) { + return getQuotaListGetVolumesAttributeTypeOk(o.Volumes) +} + +// SetVolumes sets field value +func (o *QuotaList) SetVolumes(v QuotaListGetVolumesRetType) { + setQuotaListGetVolumesAttributeType(&o.Volumes, v) +} + +func (o QuotaList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListGetBackupGigabytesAttributeTypeOk(o.BackupGigabytes); ok { + toSerialize["BackupGigabytes"] = val + } + if val, ok := getQuotaListGetBackupsAttributeTypeOk(o.Backups); ok { + toSerialize["Backups"] = val + } + if val, ok := getQuotaListGetGigabytesAttributeTypeOk(o.Gigabytes); ok { + toSerialize["Gigabytes"] = val + } + if val, ok := getQuotaListGetNetworksAttributeTypeOk(o.Networks); ok { + toSerialize["Networks"] = val + } + if val, ok := getQuotaListGetNicsAttributeTypeOk(o.Nics); ok { + toSerialize["Nics"] = val + } + if val, ok := getQuotaListGetPublicIpsAttributeTypeOk(o.PublicIps); ok { + toSerialize["PublicIps"] = val + } + if val, ok := getQuotaListGetRamAttributeTypeOk(o.Ram); ok { + toSerialize["Ram"] = val + } + if val, ok := getQuotaListGetSecurityGroupRulesAttributeTypeOk(o.SecurityGroupRules); ok { + toSerialize["SecurityGroupRules"] = val + } + if val, ok := getQuotaListGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getQuotaListGetSnapshotsAttributeTypeOk(o.Snapshots); ok { + toSerialize["Snapshots"] = val + } + if val, ok := getQuotaListGetVcpuAttributeTypeOk(o.Vcpu); ok { + toSerialize["Vcpu"] = val + } + if val, ok := getQuotaListGetVolumesAttributeTypeOk(o.Volumes); ok { + toSerialize["Volumes"] = val + } + return toSerialize, nil +} + +type NullableQuotaList struct { + value *QuotaList + isSet bool +} + +func (v NullableQuotaList) Get() *QuotaList { + return v.value +} + +func (v *NullableQuotaList) Set(val *QuotaList) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaList) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaList(val *QuotaList) *NullableQuotaList { + return &NullableQuotaList{value: val, isSet: true} +} + +func (v NullableQuotaList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_backup_gigabytes.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_backup_gigabytes.go new file mode 100644 index 00000000..724132c7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_backup_gigabytes.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListBackupGigabytes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListBackupGigabytes{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListBackupGigabytesGetLimitAttributeType = *int64 +type QuotaListBackupGigabytesGetLimitArgType = int64 +type QuotaListBackupGigabytesGetLimitRetType = int64 + +func getQuotaListBackupGigabytesGetLimitAttributeTypeOk(arg QuotaListBackupGigabytesGetLimitAttributeType) (ret QuotaListBackupGigabytesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupGigabytesGetLimitAttributeType(arg *QuotaListBackupGigabytesGetLimitAttributeType, val QuotaListBackupGigabytesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListBackupGigabytesGetUsageAttributeType = *int64 +type QuotaListBackupGigabytesGetUsageArgType = int64 +type QuotaListBackupGigabytesGetUsageRetType = int64 + +func getQuotaListBackupGigabytesGetUsageAttributeTypeOk(arg QuotaListBackupGigabytesGetUsageAttributeType) (ret QuotaListBackupGigabytesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupGigabytesGetUsageAttributeType(arg *QuotaListBackupGigabytesGetUsageAttributeType, val QuotaListBackupGigabytesGetUsageRetType) { + *arg = &val +} + +// QuotaListBackupGigabytes Total size in GiB of backups. +type QuotaListBackupGigabytes struct { + // REQUIRED + Limit QuotaListBackupGigabytesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListBackupGigabytesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListBackupGigabytes QuotaListBackupGigabytes + +// NewQuotaListBackupGigabytes instantiates a new QuotaListBackupGigabytes object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListBackupGigabytes(limit QuotaListBackupGigabytesGetLimitArgType, usage QuotaListBackupGigabytesGetUsageArgType) *QuotaListBackupGigabytes { + this := QuotaListBackupGigabytes{} + setQuotaListBackupGigabytesGetLimitAttributeType(&this.Limit, limit) + setQuotaListBackupGigabytesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListBackupGigabytesWithDefaults instantiates a new QuotaListBackupGigabytes object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListBackupGigabytesWithDefaults() *QuotaListBackupGigabytes { + this := QuotaListBackupGigabytes{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListBackupGigabytes) GetLimit() (ret QuotaListBackupGigabytesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackupGigabytes) GetLimitOk() (ret QuotaListBackupGigabytesGetLimitRetType, ok bool) { + return getQuotaListBackupGigabytesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListBackupGigabytes) SetLimit(v QuotaListBackupGigabytesGetLimitRetType) { + setQuotaListBackupGigabytesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListBackupGigabytes) GetUsage() (ret QuotaListBackupGigabytesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackupGigabytes) GetUsageOk() (ret QuotaListBackupGigabytesGetUsageRetType, ok bool) { + return getQuotaListBackupGigabytesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListBackupGigabytes) SetUsage(v QuotaListBackupGigabytesGetUsageRetType) { + setQuotaListBackupGigabytesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListBackupGigabytes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListBackupGigabytesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListBackupGigabytesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListBackupGigabytes struct { + value *QuotaListBackupGigabytes + isSet bool +} + +func (v NullableQuotaListBackupGigabytes) Get() *QuotaListBackupGigabytes { + return v.value +} + +func (v *NullableQuotaListBackupGigabytes) Set(val *QuotaListBackupGigabytes) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListBackupGigabytes) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListBackupGigabytes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListBackupGigabytes(val *QuotaListBackupGigabytes) *NullableQuotaListBackupGigabytes { + return &NullableQuotaListBackupGigabytes{value: val, isSet: true} +} + +func (v NullableQuotaListBackupGigabytes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListBackupGigabytes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_backups.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_backups.go new file mode 100644 index 00000000..1b6a19d7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_backups.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListBackups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListBackups{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListBackupsGetLimitAttributeType = *int64 +type QuotaListBackupsGetLimitArgType = int64 +type QuotaListBackupsGetLimitRetType = int64 + +func getQuotaListBackupsGetLimitAttributeTypeOk(arg QuotaListBackupsGetLimitAttributeType) (ret QuotaListBackupsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupsGetLimitAttributeType(arg *QuotaListBackupsGetLimitAttributeType, val QuotaListBackupsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListBackupsGetUsageAttributeType = *int64 +type QuotaListBackupsGetUsageArgType = int64 +type QuotaListBackupsGetUsageRetType = int64 + +func getQuotaListBackupsGetUsageAttributeTypeOk(arg QuotaListBackupsGetUsageAttributeType) (ret QuotaListBackupsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListBackupsGetUsageAttributeType(arg *QuotaListBackupsGetUsageAttributeType, val QuotaListBackupsGetUsageRetType) { + *arg = &val +} + +// QuotaListBackups Number of backups. +type QuotaListBackups struct { + // REQUIRED + Limit QuotaListBackupsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListBackupsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListBackups QuotaListBackups + +// NewQuotaListBackups instantiates a new QuotaListBackups object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListBackups(limit QuotaListBackupsGetLimitArgType, usage QuotaListBackupsGetUsageArgType) *QuotaListBackups { + this := QuotaListBackups{} + setQuotaListBackupsGetLimitAttributeType(&this.Limit, limit) + setQuotaListBackupsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListBackupsWithDefaults instantiates a new QuotaListBackups object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListBackupsWithDefaults() *QuotaListBackups { + this := QuotaListBackups{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListBackups) GetLimit() (ret QuotaListBackupsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackups) GetLimitOk() (ret QuotaListBackupsGetLimitRetType, ok bool) { + return getQuotaListBackupsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListBackups) SetLimit(v QuotaListBackupsGetLimitRetType) { + setQuotaListBackupsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListBackups) GetUsage() (ret QuotaListBackupsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListBackups) GetUsageOk() (ret QuotaListBackupsGetUsageRetType, ok bool) { + return getQuotaListBackupsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListBackups) SetUsage(v QuotaListBackupsGetUsageRetType) { + setQuotaListBackupsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListBackups) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListBackupsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListBackupsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListBackups struct { + value *QuotaListBackups + isSet bool +} + +func (v NullableQuotaListBackups) Get() *QuotaListBackups { + return v.value +} + +func (v *NullableQuotaListBackups) Set(val *QuotaListBackups) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListBackups) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListBackups) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListBackups(val *QuotaListBackups) *NullableQuotaListBackups { + return &NullableQuotaListBackups{value: val, isSet: true} +} + +func (v NullableQuotaListBackups) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListBackups) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_gigabytes.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_gigabytes.go new file mode 100644 index 00000000..0dd6f380 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_gigabytes.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListGigabytes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListGigabytes{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListGigabytesGetLimitAttributeType = *int64 +type QuotaListGigabytesGetLimitArgType = int64 +type QuotaListGigabytesGetLimitRetType = int64 + +func getQuotaListGigabytesGetLimitAttributeTypeOk(arg QuotaListGigabytesGetLimitAttributeType) (ret QuotaListGigabytesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGigabytesGetLimitAttributeType(arg *QuotaListGigabytesGetLimitAttributeType, val QuotaListGigabytesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListGigabytesGetUsageAttributeType = *int64 +type QuotaListGigabytesGetUsageArgType = int64 +type QuotaListGigabytesGetUsageRetType = int64 + +func getQuotaListGigabytesGetUsageAttributeTypeOk(arg QuotaListGigabytesGetUsageAttributeType) (ret QuotaListGigabytesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListGigabytesGetUsageAttributeType(arg *QuotaListGigabytesGetUsageAttributeType, val QuotaListGigabytesGetUsageRetType) { + *arg = &val +} + +// QuotaListGigabytes Total size in GiB of volumes and snapshots. +type QuotaListGigabytes struct { + // REQUIRED + Limit QuotaListGigabytesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListGigabytesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListGigabytes QuotaListGigabytes + +// NewQuotaListGigabytes instantiates a new QuotaListGigabytes object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListGigabytes(limit QuotaListGigabytesGetLimitArgType, usage QuotaListGigabytesGetUsageArgType) *QuotaListGigabytes { + this := QuotaListGigabytes{} + setQuotaListGigabytesGetLimitAttributeType(&this.Limit, limit) + setQuotaListGigabytesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListGigabytesWithDefaults instantiates a new QuotaListGigabytes object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListGigabytesWithDefaults() *QuotaListGigabytes { + this := QuotaListGigabytes{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListGigabytes) GetLimit() (ret QuotaListGigabytesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListGigabytes) GetLimitOk() (ret QuotaListGigabytesGetLimitRetType, ok bool) { + return getQuotaListGigabytesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListGigabytes) SetLimit(v QuotaListGigabytesGetLimitRetType) { + setQuotaListGigabytesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListGigabytes) GetUsage() (ret QuotaListGigabytesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListGigabytes) GetUsageOk() (ret QuotaListGigabytesGetUsageRetType, ok bool) { + return getQuotaListGigabytesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListGigabytes) SetUsage(v QuotaListGigabytesGetUsageRetType) { + setQuotaListGigabytesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListGigabytes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListGigabytesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListGigabytesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListGigabytes struct { + value *QuotaListGigabytes + isSet bool +} + +func (v NullableQuotaListGigabytes) Get() *QuotaListGigabytes { + return v.value +} + +func (v *NullableQuotaListGigabytes) Set(val *QuotaListGigabytes) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListGigabytes) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListGigabytes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListGigabytes(val *QuotaListGigabytes) *NullableQuotaListGigabytes { + return &NullableQuotaListGigabytes{value: val, isSet: true} +} + +func (v NullableQuotaListGigabytes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListGigabytes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_networks.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_networks.go new file mode 100644 index 00000000..718406a7 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_networks.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListNetworks type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListNetworks{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListNetworksGetLimitAttributeType = *int64 +type QuotaListNetworksGetLimitArgType = int64 +type QuotaListNetworksGetLimitRetType = int64 + +func getQuotaListNetworksGetLimitAttributeTypeOk(arg QuotaListNetworksGetLimitAttributeType) (ret QuotaListNetworksGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNetworksGetLimitAttributeType(arg *QuotaListNetworksGetLimitAttributeType, val QuotaListNetworksGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListNetworksGetUsageAttributeType = *int64 +type QuotaListNetworksGetUsageArgType = int64 +type QuotaListNetworksGetUsageRetType = int64 + +func getQuotaListNetworksGetUsageAttributeTypeOk(arg QuotaListNetworksGetUsageAttributeType) (ret QuotaListNetworksGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNetworksGetUsageAttributeType(arg *QuotaListNetworksGetUsageAttributeType, val QuotaListNetworksGetUsageRetType) { + *arg = &val +} + +// QuotaListNetworks Number of networks. +type QuotaListNetworks struct { + // REQUIRED + Limit QuotaListNetworksGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListNetworksGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListNetworks QuotaListNetworks + +// NewQuotaListNetworks instantiates a new QuotaListNetworks object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListNetworks(limit QuotaListNetworksGetLimitArgType, usage QuotaListNetworksGetUsageArgType) *QuotaListNetworks { + this := QuotaListNetworks{} + setQuotaListNetworksGetLimitAttributeType(&this.Limit, limit) + setQuotaListNetworksGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListNetworksWithDefaults instantiates a new QuotaListNetworks object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListNetworksWithDefaults() *QuotaListNetworks { + this := QuotaListNetworks{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListNetworks) GetLimit() (ret QuotaListNetworksGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListNetworks) GetLimitOk() (ret QuotaListNetworksGetLimitRetType, ok bool) { + return getQuotaListNetworksGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListNetworks) SetLimit(v QuotaListNetworksGetLimitRetType) { + setQuotaListNetworksGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListNetworks) GetUsage() (ret QuotaListNetworksGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListNetworks) GetUsageOk() (ret QuotaListNetworksGetUsageRetType, ok bool) { + return getQuotaListNetworksGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListNetworks) SetUsage(v QuotaListNetworksGetUsageRetType) { + setQuotaListNetworksGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListNetworks) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListNetworksGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListNetworksGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListNetworks struct { + value *QuotaListNetworks + isSet bool +} + +func (v NullableQuotaListNetworks) Get() *QuotaListNetworks { + return v.value +} + +func (v *NullableQuotaListNetworks) Set(val *QuotaListNetworks) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListNetworks) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListNetworks) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListNetworks(val *QuotaListNetworks) *NullableQuotaListNetworks { + return &NullableQuotaListNetworks{value: val, isSet: true} +} + +func (v NullableQuotaListNetworks) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListNetworks) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_nics.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_nics.go new file mode 100644 index 00000000..5de35897 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_nics.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListNics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListNics{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListNicsGetLimitAttributeType = *int64 +type QuotaListNicsGetLimitArgType = int64 +type QuotaListNicsGetLimitRetType = int64 + +func getQuotaListNicsGetLimitAttributeTypeOk(arg QuotaListNicsGetLimitAttributeType) (ret QuotaListNicsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNicsGetLimitAttributeType(arg *QuotaListNicsGetLimitAttributeType, val QuotaListNicsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListNicsGetUsageAttributeType = *int64 +type QuotaListNicsGetUsageArgType = int64 +type QuotaListNicsGetUsageRetType = int64 + +func getQuotaListNicsGetUsageAttributeTypeOk(arg QuotaListNicsGetUsageAttributeType) (ret QuotaListNicsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListNicsGetUsageAttributeType(arg *QuotaListNicsGetUsageAttributeType, val QuotaListNicsGetUsageRetType) { + *arg = &val +} + +// QuotaListNics Number of network interfaces. +type QuotaListNics struct { + // REQUIRED + Limit QuotaListNicsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListNicsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListNics QuotaListNics + +// NewQuotaListNics instantiates a new QuotaListNics object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListNics(limit QuotaListNicsGetLimitArgType, usage QuotaListNicsGetUsageArgType) *QuotaListNics { + this := QuotaListNics{} + setQuotaListNicsGetLimitAttributeType(&this.Limit, limit) + setQuotaListNicsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListNicsWithDefaults instantiates a new QuotaListNics object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListNicsWithDefaults() *QuotaListNics { + this := QuotaListNics{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListNics) GetLimit() (ret QuotaListNicsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListNics) GetLimitOk() (ret QuotaListNicsGetLimitRetType, ok bool) { + return getQuotaListNicsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListNics) SetLimit(v QuotaListNicsGetLimitRetType) { + setQuotaListNicsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListNics) GetUsage() (ret QuotaListNicsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListNics) GetUsageOk() (ret QuotaListNicsGetUsageRetType, ok bool) { + return getQuotaListNicsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListNics) SetUsage(v QuotaListNicsGetUsageRetType) { + setQuotaListNicsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListNics) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListNicsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListNicsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListNics struct { + value *QuotaListNics + isSet bool +} + +func (v NullableQuotaListNics) Get() *QuotaListNics { + return v.value +} + +func (v *NullableQuotaListNics) Set(val *QuotaListNics) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListNics) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListNics) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListNics(val *QuotaListNics) *NullableQuotaListNics { + return &NullableQuotaListNics{value: val, isSet: true} +} + +func (v NullableQuotaListNics) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListNics) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_public_ips.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_public_ips.go new file mode 100644 index 00000000..40667f8b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_public_ips.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListPublicIps type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListPublicIps{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListPublicIpsGetLimitAttributeType = *int64 +type QuotaListPublicIpsGetLimitArgType = int64 +type QuotaListPublicIpsGetLimitRetType = int64 + +func getQuotaListPublicIpsGetLimitAttributeTypeOk(arg QuotaListPublicIpsGetLimitAttributeType) (ret QuotaListPublicIpsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListPublicIpsGetLimitAttributeType(arg *QuotaListPublicIpsGetLimitAttributeType, val QuotaListPublicIpsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListPublicIpsGetUsageAttributeType = *int64 +type QuotaListPublicIpsGetUsageArgType = int64 +type QuotaListPublicIpsGetUsageRetType = int64 + +func getQuotaListPublicIpsGetUsageAttributeTypeOk(arg QuotaListPublicIpsGetUsageAttributeType) (ret QuotaListPublicIpsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListPublicIpsGetUsageAttributeType(arg *QuotaListPublicIpsGetUsageAttributeType, val QuotaListPublicIpsGetUsageRetType) { + *arg = &val +} + +// QuotaListPublicIps Number of public IP addresses. +type QuotaListPublicIps struct { + // REQUIRED + Limit QuotaListPublicIpsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListPublicIpsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListPublicIps QuotaListPublicIps + +// NewQuotaListPublicIps instantiates a new QuotaListPublicIps object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListPublicIps(limit QuotaListPublicIpsGetLimitArgType, usage QuotaListPublicIpsGetUsageArgType) *QuotaListPublicIps { + this := QuotaListPublicIps{} + setQuotaListPublicIpsGetLimitAttributeType(&this.Limit, limit) + setQuotaListPublicIpsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListPublicIpsWithDefaults instantiates a new QuotaListPublicIps object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListPublicIpsWithDefaults() *QuotaListPublicIps { + this := QuotaListPublicIps{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListPublicIps) GetLimit() (ret QuotaListPublicIpsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListPublicIps) GetLimitOk() (ret QuotaListPublicIpsGetLimitRetType, ok bool) { + return getQuotaListPublicIpsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListPublicIps) SetLimit(v QuotaListPublicIpsGetLimitRetType) { + setQuotaListPublicIpsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListPublicIps) GetUsage() (ret QuotaListPublicIpsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListPublicIps) GetUsageOk() (ret QuotaListPublicIpsGetUsageRetType, ok bool) { + return getQuotaListPublicIpsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListPublicIps) SetUsage(v QuotaListPublicIpsGetUsageRetType) { + setQuotaListPublicIpsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListPublicIps) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListPublicIpsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListPublicIpsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListPublicIps struct { + value *QuotaListPublicIps + isSet bool +} + +func (v NullableQuotaListPublicIps) Get() *QuotaListPublicIps { + return v.value +} + +func (v *NullableQuotaListPublicIps) Set(val *QuotaListPublicIps) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListPublicIps) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListPublicIps) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListPublicIps(val *QuotaListPublicIps) *NullableQuotaListPublicIps { + return &NullableQuotaListPublicIps{value: val, isSet: true} +} + +func (v NullableQuotaListPublicIps) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListPublicIps) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_ram.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_ram.go new file mode 100644 index 00000000..148cb016 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_ram.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListRam type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListRam{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListRamGetLimitAttributeType = *int64 +type QuotaListRamGetLimitArgType = int64 +type QuotaListRamGetLimitRetType = int64 + +func getQuotaListRamGetLimitAttributeTypeOk(arg QuotaListRamGetLimitAttributeType) (ret QuotaListRamGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListRamGetLimitAttributeType(arg *QuotaListRamGetLimitAttributeType, val QuotaListRamGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListRamGetUsageAttributeType = *int64 +type QuotaListRamGetUsageArgType = int64 +type QuotaListRamGetUsageRetType = int64 + +func getQuotaListRamGetUsageAttributeTypeOk(arg QuotaListRamGetUsageAttributeType) (ret QuotaListRamGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListRamGetUsageAttributeType(arg *QuotaListRamGetUsageAttributeType, val QuotaListRamGetUsageRetType) { + *arg = &val +} + +// QuotaListRam Amount of server RAM in MiB. +type QuotaListRam struct { + // REQUIRED + Limit QuotaListRamGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListRamGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListRam QuotaListRam + +// NewQuotaListRam instantiates a new QuotaListRam object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListRam(limit QuotaListRamGetLimitArgType, usage QuotaListRamGetUsageArgType) *QuotaListRam { + this := QuotaListRam{} + setQuotaListRamGetLimitAttributeType(&this.Limit, limit) + setQuotaListRamGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListRamWithDefaults instantiates a new QuotaListRam object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListRamWithDefaults() *QuotaListRam { + this := QuotaListRam{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListRam) GetLimit() (ret QuotaListRamGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListRam) GetLimitOk() (ret QuotaListRamGetLimitRetType, ok bool) { + return getQuotaListRamGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListRam) SetLimit(v QuotaListRamGetLimitRetType) { + setQuotaListRamGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListRam) GetUsage() (ret QuotaListRamGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListRam) GetUsageOk() (ret QuotaListRamGetUsageRetType, ok bool) { + return getQuotaListRamGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListRam) SetUsage(v QuotaListRamGetUsageRetType) { + setQuotaListRamGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListRam) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListRamGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListRamGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListRam struct { + value *QuotaListRam + isSet bool +} + +func (v NullableQuotaListRam) Get() *QuotaListRam { + return v.value +} + +func (v *NullableQuotaListRam) Set(val *QuotaListRam) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListRam) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListRam) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListRam(val *QuotaListRam) *NullableQuotaListRam { + return &NullableQuotaListRam{value: val, isSet: true} +} + +func (v NullableQuotaListRam) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListRam) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_response.go new file mode 100644 index 00000000..75a23f98 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_response.go @@ -0,0 +1,125 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListResponse{} + +/* + types and functions for quotas +*/ + +// isModel +type QuotaListResponseGetQuotasAttributeType = *QuotaList +type QuotaListResponseGetQuotasArgType = QuotaList +type QuotaListResponseGetQuotasRetType = QuotaList + +func getQuotaListResponseGetQuotasAttributeTypeOk(arg QuotaListResponseGetQuotasAttributeType) (ret QuotaListResponseGetQuotasRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListResponseGetQuotasAttributeType(arg *QuotaListResponseGetQuotasAttributeType, val QuotaListResponseGetQuotasRetType) { + *arg = &val +} + +// QuotaListResponse Quotas list response. +type QuotaListResponse struct { + // REQUIRED + Quotas QuotaListResponseGetQuotasAttributeType `json:"quotas" required:"true"` +} + +type _QuotaListResponse QuotaListResponse + +// NewQuotaListResponse instantiates a new QuotaListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListResponse(quotas QuotaListResponseGetQuotasArgType) *QuotaListResponse { + this := QuotaListResponse{} + setQuotaListResponseGetQuotasAttributeType(&this.Quotas, quotas) + return &this +} + +// NewQuotaListResponseWithDefaults instantiates a new QuotaListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListResponseWithDefaults() *QuotaListResponse { + this := QuotaListResponse{} + return &this +} + +// GetQuotas returns the Quotas field value +func (o *QuotaListResponse) GetQuotas() (ret QuotaListResponseGetQuotasRetType) { + ret, _ = o.GetQuotasOk() + return ret +} + +// GetQuotasOk returns a tuple with the Quotas field value +// and a boolean to check if the value has been set. +func (o *QuotaListResponse) GetQuotasOk() (ret QuotaListResponseGetQuotasRetType, ok bool) { + return getQuotaListResponseGetQuotasAttributeTypeOk(o.Quotas) +} + +// SetQuotas sets field value +func (o *QuotaListResponse) SetQuotas(v QuotaListResponseGetQuotasRetType) { + setQuotaListResponseGetQuotasAttributeType(&o.Quotas, v) +} + +func (o QuotaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListResponseGetQuotasAttributeTypeOk(o.Quotas); ok { + toSerialize["Quotas"] = val + } + return toSerialize, nil +} + +type NullableQuotaListResponse struct { + value *QuotaListResponse + isSet bool +} + +func (v NullableQuotaListResponse) Get() *QuotaListResponse { + return v.value +} + +func (v *NullableQuotaListResponse) Set(val *QuotaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListResponse(val *QuotaListResponse) *NullableQuotaListResponse { + return &NullableQuotaListResponse{value: val, isSet: true} +} + +func (v NullableQuotaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_security_group_rules.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_security_group_rules.go new file mode 100644 index 00000000..ce9732f5 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_security_group_rules.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListSecurityGroupRules type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListSecurityGroupRules{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListSecurityGroupRulesGetLimitAttributeType = *int64 +type QuotaListSecurityGroupRulesGetLimitArgType = int64 +type QuotaListSecurityGroupRulesGetLimitRetType = int64 + +func getQuotaListSecurityGroupRulesGetLimitAttributeTypeOk(arg QuotaListSecurityGroupRulesGetLimitAttributeType) (ret QuotaListSecurityGroupRulesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupRulesGetLimitAttributeType(arg *QuotaListSecurityGroupRulesGetLimitAttributeType, val QuotaListSecurityGroupRulesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListSecurityGroupRulesGetUsageAttributeType = *int64 +type QuotaListSecurityGroupRulesGetUsageArgType = int64 +type QuotaListSecurityGroupRulesGetUsageRetType = int64 + +func getQuotaListSecurityGroupRulesGetUsageAttributeTypeOk(arg QuotaListSecurityGroupRulesGetUsageAttributeType) (ret QuotaListSecurityGroupRulesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupRulesGetUsageAttributeType(arg *QuotaListSecurityGroupRulesGetUsageAttributeType, val QuotaListSecurityGroupRulesGetUsageRetType) { + *arg = &val +} + +// QuotaListSecurityGroupRules Number of security group rules. +type QuotaListSecurityGroupRules struct { + // REQUIRED + Limit QuotaListSecurityGroupRulesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListSecurityGroupRulesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListSecurityGroupRules QuotaListSecurityGroupRules + +// NewQuotaListSecurityGroupRules instantiates a new QuotaListSecurityGroupRules object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListSecurityGroupRules(limit QuotaListSecurityGroupRulesGetLimitArgType, usage QuotaListSecurityGroupRulesGetUsageArgType) *QuotaListSecurityGroupRules { + this := QuotaListSecurityGroupRules{} + setQuotaListSecurityGroupRulesGetLimitAttributeType(&this.Limit, limit) + setQuotaListSecurityGroupRulesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListSecurityGroupRulesWithDefaults instantiates a new QuotaListSecurityGroupRules object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListSecurityGroupRulesWithDefaults() *QuotaListSecurityGroupRules { + this := QuotaListSecurityGroupRules{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListSecurityGroupRules) GetLimit() (ret QuotaListSecurityGroupRulesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroupRules) GetLimitOk() (ret QuotaListSecurityGroupRulesGetLimitRetType, ok bool) { + return getQuotaListSecurityGroupRulesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListSecurityGroupRules) SetLimit(v QuotaListSecurityGroupRulesGetLimitRetType) { + setQuotaListSecurityGroupRulesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListSecurityGroupRules) GetUsage() (ret QuotaListSecurityGroupRulesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroupRules) GetUsageOk() (ret QuotaListSecurityGroupRulesGetUsageRetType, ok bool) { + return getQuotaListSecurityGroupRulesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListSecurityGroupRules) SetUsage(v QuotaListSecurityGroupRulesGetUsageRetType) { + setQuotaListSecurityGroupRulesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListSecurityGroupRules) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListSecurityGroupRulesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListSecurityGroupRulesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListSecurityGroupRules struct { + value *QuotaListSecurityGroupRules + isSet bool +} + +func (v NullableQuotaListSecurityGroupRules) Get() *QuotaListSecurityGroupRules { + return v.value +} + +func (v *NullableQuotaListSecurityGroupRules) Set(val *QuotaListSecurityGroupRules) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListSecurityGroupRules) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListSecurityGroupRules) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListSecurityGroupRules(val *QuotaListSecurityGroupRules) *NullableQuotaListSecurityGroupRules { + return &NullableQuotaListSecurityGroupRules{value: val, isSet: true} +} + +func (v NullableQuotaListSecurityGroupRules) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListSecurityGroupRules) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_security_groups.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_security_groups.go new file mode 100644 index 00000000..f2f0c324 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_security_groups.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListSecurityGroups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListSecurityGroups{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListSecurityGroupsGetLimitAttributeType = *int64 +type QuotaListSecurityGroupsGetLimitArgType = int64 +type QuotaListSecurityGroupsGetLimitRetType = int64 + +func getQuotaListSecurityGroupsGetLimitAttributeTypeOk(arg QuotaListSecurityGroupsGetLimitAttributeType) (ret QuotaListSecurityGroupsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupsGetLimitAttributeType(arg *QuotaListSecurityGroupsGetLimitAttributeType, val QuotaListSecurityGroupsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListSecurityGroupsGetUsageAttributeType = *int64 +type QuotaListSecurityGroupsGetUsageArgType = int64 +type QuotaListSecurityGroupsGetUsageRetType = int64 + +func getQuotaListSecurityGroupsGetUsageAttributeTypeOk(arg QuotaListSecurityGroupsGetUsageAttributeType) (ret QuotaListSecurityGroupsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSecurityGroupsGetUsageAttributeType(arg *QuotaListSecurityGroupsGetUsageAttributeType, val QuotaListSecurityGroupsGetUsageRetType) { + *arg = &val +} + +// QuotaListSecurityGroups Number of security groups. +type QuotaListSecurityGroups struct { + // REQUIRED + Limit QuotaListSecurityGroupsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListSecurityGroupsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListSecurityGroups QuotaListSecurityGroups + +// NewQuotaListSecurityGroups instantiates a new QuotaListSecurityGroups object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListSecurityGroups(limit QuotaListSecurityGroupsGetLimitArgType, usage QuotaListSecurityGroupsGetUsageArgType) *QuotaListSecurityGroups { + this := QuotaListSecurityGroups{} + setQuotaListSecurityGroupsGetLimitAttributeType(&this.Limit, limit) + setQuotaListSecurityGroupsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListSecurityGroupsWithDefaults instantiates a new QuotaListSecurityGroups object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListSecurityGroupsWithDefaults() *QuotaListSecurityGroups { + this := QuotaListSecurityGroups{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListSecurityGroups) GetLimit() (ret QuotaListSecurityGroupsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroups) GetLimitOk() (ret QuotaListSecurityGroupsGetLimitRetType, ok bool) { + return getQuotaListSecurityGroupsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListSecurityGroups) SetLimit(v QuotaListSecurityGroupsGetLimitRetType) { + setQuotaListSecurityGroupsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListSecurityGroups) GetUsage() (ret QuotaListSecurityGroupsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListSecurityGroups) GetUsageOk() (ret QuotaListSecurityGroupsGetUsageRetType, ok bool) { + return getQuotaListSecurityGroupsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListSecurityGroups) SetUsage(v QuotaListSecurityGroupsGetUsageRetType) { + setQuotaListSecurityGroupsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListSecurityGroups) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListSecurityGroupsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListSecurityGroupsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListSecurityGroups struct { + value *QuotaListSecurityGroups + isSet bool +} + +func (v NullableQuotaListSecurityGroups) Get() *QuotaListSecurityGroups { + return v.value +} + +func (v *NullableQuotaListSecurityGroups) Set(val *QuotaListSecurityGroups) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListSecurityGroups) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListSecurityGroups) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListSecurityGroups(val *QuotaListSecurityGroups) *NullableQuotaListSecurityGroups { + return &NullableQuotaListSecurityGroups{value: val, isSet: true} +} + +func (v NullableQuotaListSecurityGroups) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListSecurityGroups) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_snapshots.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_snapshots.go new file mode 100644 index 00000000..a31f0c1a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_snapshots.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListSnapshots type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListSnapshots{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListSnapshotsGetLimitAttributeType = *int64 +type QuotaListSnapshotsGetLimitArgType = int64 +type QuotaListSnapshotsGetLimitRetType = int64 + +func getQuotaListSnapshotsGetLimitAttributeTypeOk(arg QuotaListSnapshotsGetLimitAttributeType) (ret QuotaListSnapshotsGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSnapshotsGetLimitAttributeType(arg *QuotaListSnapshotsGetLimitAttributeType, val QuotaListSnapshotsGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListSnapshotsGetUsageAttributeType = *int64 +type QuotaListSnapshotsGetUsageArgType = int64 +type QuotaListSnapshotsGetUsageRetType = int64 + +func getQuotaListSnapshotsGetUsageAttributeTypeOk(arg QuotaListSnapshotsGetUsageAttributeType) (ret QuotaListSnapshotsGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListSnapshotsGetUsageAttributeType(arg *QuotaListSnapshotsGetUsageAttributeType, val QuotaListSnapshotsGetUsageRetType) { + *arg = &val +} + +// QuotaListSnapshots Number of snapshots. +type QuotaListSnapshots struct { + // REQUIRED + Limit QuotaListSnapshotsGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListSnapshotsGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListSnapshots QuotaListSnapshots + +// NewQuotaListSnapshots instantiates a new QuotaListSnapshots object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListSnapshots(limit QuotaListSnapshotsGetLimitArgType, usage QuotaListSnapshotsGetUsageArgType) *QuotaListSnapshots { + this := QuotaListSnapshots{} + setQuotaListSnapshotsGetLimitAttributeType(&this.Limit, limit) + setQuotaListSnapshotsGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListSnapshotsWithDefaults instantiates a new QuotaListSnapshots object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListSnapshotsWithDefaults() *QuotaListSnapshots { + this := QuotaListSnapshots{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListSnapshots) GetLimit() (ret QuotaListSnapshotsGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListSnapshots) GetLimitOk() (ret QuotaListSnapshotsGetLimitRetType, ok bool) { + return getQuotaListSnapshotsGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListSnapshots) SetLimit(v QuotaListSnapshotsGetLimitRetType) { + setQuotaListSnapshotsGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListSnapshots) GetUsage() (ret QuotaListSnapshotsGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListSnapshots) GetUsageOk() (ret QuotaListSnapshotsGetUsageRetType, ok bool) { + return getQuotaListSnapshotsGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListSnapshots) SetUsage(v QuotaListSnapshotsGetUsageRetType) { + setQuotaListSnapshotsGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListSnapshots) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListSnapshotsGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListSnapshotsGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListSnapshots struct { + value *QuotaListSnapshots + isSet bool +} + +func (v NullableQuotaListSnapshots) Get() *QuotaListSnapshots { + return v.value +} + +func (v *NullableQuotaListSnapshots) Set(val *QuotaListSnapshots) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListSnapshots) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListSnapshots) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListSnapshots(val *QuotaListSnapshots) *NullableQuotaListSnapshots { + return &NullableQuotaListSnapshots{value: val, isSet: true} +} + +func (v NullableQuotaListSnapshots) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListSnapshots) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_vcpu.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_vcpu.go new file mode 100644 index 00000000..62a869cc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_vcpu.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListVcpu type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListVcpu{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListVcpuGetLimitAttributeType = *int64 +type QuotaListVcpuGetLimitArgType = int64 +type QuotaListVcpuGetLimitRetType = int64 + +func getQuotaListVcpuGetLimitAttributeTypeOk(arg QuotaListVcpuGetLimitAttributeType) (ret QuotaListVcpuGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVcpuGetLimitAttributeType(arg *QuotaListVcpuGetLimitAttributeType, val QuotaListVcpuGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListVcpuGetUsageAttributeType = *int64 +type QuotaListVcpuGetUsageArgType = int64 +type QuotaListVcpuGetUsageRetType = int64 + +func getQuotaListVcpuGetUsageAttributeTypeOk(arg QuotaListVcpuGetUsageAttributeType) (ret QuotaListVcpuGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVcpuGetUsageAttributeType(arg *QuotaListVcpuGetUsageAttributeType, val QuotaListVcpuGetUsageRetType) { + *arg = &val +} + +// QuotaListVcpu Number of server cores. +type QuotaListVcpu struct { + // REQUIRED + Limit QuotaListVcpuGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListVcpuGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListVcpu QuotaListVcpu + +// NewQuotaListVcpu instantiates a new QuotaListVcpu object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListVcpu(limit QuotaListVcpuGetLimitArgType, usage QuotaListVcpuGetUsageArgType) *QuotaListVcpu { + this := QuotaListVcpu{} + setQuotaListVcpuGetLimitAttributeType(&this.Limit, limit) + setQuotaListVcpuGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListVcpuWithDefaults instantiates a new QuotaListVcpu object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListVcpuWithDefaults() *QuotaListVcpu { + this := QuotaListVcpu{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListVcpu) GetLimit() (ret QuotaListVcpuGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListVcpu) GetLimitOk() (ret QuotaListVcpuGetLimitRetType, ok bool) { + return getQuotaListVcpuGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListVcpu) SetLimit(v QuotaListVcpuGetLimitRetType) { + setQuotaListVcpuGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListVcpu) GetUsage() (ret QuotaListVcpuGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListVcpu) GetUsageOk() (ret QuotaListVcpuGetUsageRetType, ok bool) { + return getQuotaListVcpuGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListVcpu) SetUsage(v QuotaListVcpuGetUsageRetType) { + setQuotaListVcpuGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListVcpu) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListVcpuGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListVcpuGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListVcpu struct { + value *QuotaListVcpu + isSet bool +} + +func (v NullableQuotaListVcpu) Get() *QuotaListVcpu { + return v.value +} + +func (v *NullableQuotaListVcpu) Set(val *QuotaListVcpu) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListVcpu) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListVcpu) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListVcpu(val *QuotaListVcpu) *NullableQuotaListVcpu { + return &NullableQuotaListVcpu{value: val, isSet: true} +} + +func (v NullableQuotaListVcpu) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListVcpu) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_volumes.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_volumes.go new file mode 100644 index 00000000..4c5d3741 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_quota_list_volumes.go @@ -0,0 +1,168 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the QuotaListVolumes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &QuotaListVolumes{} + +/* + types and functions for limit +*/ + +// isLong +type QuotaListVolumesGetLimitAttributeType = *int64 +type QuotaListVolumesGetLimitArgType = int64 +type QuotaListVolumesGetLimitRetType = int64 + +func getQuotaListVolumesGetLimitAttributeTypeOk(arg QuotaListVolumesGetLimitAttributeType) (ret QuotaListVolumesGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVolumesGetLimitAttributeType(arg *QuotaListVolumesGetLimitAttributeType, val QuotaListVolumesGetLimitRetType) { + *arg = &val +} + +/* + types and functions for usage +*/ + +// isLong +type QuotaListVolumesGetUsageAttributeType = *int64 +type QuotaListVolumesGetUsageArgType = int64 +type QuotaListVolumesGetUsageRetType = int64 + +func getQuotaListVolumesGetUsageAttributeTypeOk(arg QuotaListVolumesGetUsageAttributeType) (ret QuotaListVolumesGetUsageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setQuotaListVolumesGetUsageAttributeType(arg *QuotaListVolumesGetUsageAttributeType, val QuotaListVolumesGetUsageRetType) { + *arg = &val +} + +// QuotaListVolumes Number of volumes. +type QuotaListVolumes struct { + // REQUIRED + Limit QuotaListVolumesGetLimitAttributeType `json:"limit" required:"true"` + // REQUIRED + Usage QuotaListVolumesGetUsageAttributeType `json:"usage" required:"true"` +} + +type _QuotaListVolumes QuotaListVolumes + +// NewQuotaListVolumes instantiates a new QuotaListVolumes object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewQuotaListVolumes(limit QuotaListVolumesGetLimitArgType, usage QuotaListVolumesGetUsageArgType) *QuotaListVolumes { + this := QuotaListVolumes{} + setQuotaListVolumesGetLimitAttributeType(&this.Limit, limit) + setQuotaListVolumesGetUsageAttributeType(&this.Usage, usage) + return &this +} + +// NewQuotaListVolumesWithDefaults instantiates a new QuotaListVolumes object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewQuotaListVolumesWithDefaults() *QuotaListVolumes { + this := QuotaListVolumes{} + return &this +} + +// GetLimit returns the Limit field value +func (o *QuotaListVolumes) GetLimit() (ret QuotaListVolumesGetLimitRetType) { + ret, _ = o.GetLimitOk() + return ret +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *QuotaListVolumes) GetLimitOk() (ret QuotaListVolumesGetLimitRetType, ok bool) { + return getQuotaListVolumesGetLimitAttributeTypeOk(o.Limit) +} + +// SetLimit sets field value +func (o *QuotaListVolumes) SetLimit(v QuotaListVolumesGetLimitRetType) { + setQuotaListVolumesGetLimitAttributeType(&o.Limit, v) +} + +// GetUsage returns the Usage field value +func (o *QuotaListVolumes) GetUsage() (ret QuotaListVolumesGetUsageRetType) { + ret, _ = o.GetUsageOk() + return ret +} + +// GetUsageOk returns a tuple with the Usage field value +// and a boolean to check if the value has been set. +func (o *QuotaListVolumes) GetUsageOk() (ret QuotaListVolumesGetUsageRetType, ok bool) { + return getQuotaListVolumesGetUsageAttributeTypeOk(o.Usage) +} + +// SetUsage sets field value +func (o *QuotaListVolumes) SetUsage(v QuotaListVolumesGetUsageRetType) { + setQuotaListVolumesGetUsageAttributeType(&o.Usage, v) +} + +func (o QuotaListVolumes) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getQuotaListVolumesGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + if val, ok := getQuotaListVolumesGetUsageAttributeTypeOk(o.Usage); ok { + toSerialize["Usage"] = val + } + return toSerialize, nil +} + +type NullableQuotaListVolumes struct { + value *QuotaListVolumes + isSet bool +} + +func (v NullableQuotaListVolumes) Get() *QuotaListVolumes { + return v.value +} + +func (v *NullableQuotaListVolumes) Set(val *QuotaListVolumes) { + v.value = val + v.isSet = true +} + +func (v NullableQuotaListVolumes) IsSet() bool { + return v.isSet +} + +func (v *NullableQuotaListVolumes) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableQuotaListVolumes(val *QuotaListVolumes) *NullableQuotaListVolumes { + return &NullableQuotaListVolumes{value: val, isSet: true} +} + +func (v NullableQuotaListVolumes) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableQuotaListVolumes) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area.go new file mode 100644 index 00000000..9877fcd0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area.go @@ -0,0 +1,176 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RegionalArea type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegionalArea{} + +/* + types and functions for ipv4 +*/ + +// isModel +type RegionalAreaGetIpv4AttributeType = *RegionalAreaIPv4 +type RegionalAreaGetIpv4ArgType = RegionalAreaIPv4 +type RegionalAreaGetIpv4RetType = RegionalAreaIPv4 + +func getRegionalAreaGetIpv4AttributeTypeOk(arg RegionalAreaGetIpv4AttributeType) (ret RegionalAreaGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaGetIpv4AttributeType(arg *RegionalAreaGetIpv4AttributeType, val RegionalAreaGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type RegionalAreaGetStatusAttributeType = *string + +func getRegionalAreaGetStatusAttributeTypeOk(arg RegionalAreaGetStatusAttributeType) (ret RegionalAreaGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaGetStatusAttributeType(arg *RegionalAreaGetStatusAttributeType, val RegionalAreaGetStatusRetType) { + *arg = &val +} + +type RegionalAreaGetStatusArgType = string +type RegionalAreaGetStatusRetType = string + +// RegionalArea The basic properties of a regional network area. +type RegionalArea struct { + Ipv4 RegionalAreaGetIpv4AttributeType `json:"ipv4,omitempty"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + Status RegionalAreaGetStatusAttributeType `json:"status,omitempty"` +} + +// NewRegionalArea instantiates a new RegionalArea object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegionalArea() *RegionalArea { + this := RegionalArea{} + return &this +} + +// NewRegionalAreaWithDefaults instantiates a new RegionalArea object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegionalAreaWithDefaults() *RegionalArea { + this := RegionalArea{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *RegionalArea) GetIpv4() (res RegionalAreaGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegionalArea) GetIpv4Ok() (ret RegionalAreaGetIpv4RetType, ok bool) { + return getRegionalAreaGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *RegionalArea) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given RegionalAreaIPv4 and assigns it to the Ipv4 field. +func (o *RegionalArea) SetIpv4(v RegionalAreaGetIpv4RetType) { + setRegionalAreaGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *RegionalArea) GetStatus() (res RegionalAreaGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegionalArea) GetStatusOk() (ret RegionalAreaGetStatusRetType, ok bool) { + return getRegionalAreaGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *RegionalArea) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *RegionalArea) SetStatus(v RegionalAreaGetStatusRetType) { + setRegionalAreaGetStatusAttributeType(&o.Status, v) +} + +func (o RegionalArea) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRegionalAreaGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getRegionalAreaGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableRegionalArea struct { + value *RegionalArea + isSet bool +} + +func (v NullableRegionalArea) Get() *RegionalArea { + return v.value +} + +func (v *NullableRegionalArea) Set(val *RegionalArea) { + v.value = val + v.isSet = true +} + +func (v NullableRegionalArea) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionalArea) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionalArea(val *RegionalArea) *NullableRegionalArea { + return &NullableRegionalArea{value: val, isSet: true} +} + +func (v NullableRegionalArea) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionalArea) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area_ipv4.go new file mode 100644 index 00000000..2c57d053 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area_ipv4.go @@ -0,0 +1,356 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RegionalAreaIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegionalAreaIPv4{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type RegionalAreaIPv4GetDefaultNameserversAttributeType = *[]string +type RegionalAreaIPv4GetDefaultNameserversArgType = []string +type RegionalAreaIPv4GetDefaultNameserversRetType = []string + +func getRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(arg RegionalAreaIPv4GetDefaultNameserversAttributeType) (ret RegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetDefaultNameserversAttributeType(arg *RegionalAreaIPv4GetDefaultNameserversAttributeType, val RegionalAreaIPv4GetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for defaultPrefixLen +*/ + +// isLong +type RegionalAreaIPv4GetDefaultPrefixLenAttributeType = *int64 +type RegionalAreaIPv4GetDefaultPrefixLenArgType = int64 +type RegionalAreaIPv4GetDefaultPrefixLenRetType = int64 + +func getRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(arg RegionalAreaIPv4GetDefaultPrefixLenAttributeType) (ret RegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetDefaultPrefixLenAttributeType(arg *RegionalAreaIPv4GetDefaultPrefixLenAttributeType, val RegionalAreaIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isLong +type RegionalAreaIPv4GetMaxPrefixLenAttributeType = *int64 +type RegionalAreaIPv4GetMaxPrefixLenArgType = int64 +type RegionalAreaIPv4GetMaxPrefixLenRetType = int64 + +func getRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(arg RegionalAreaIPv4GetMaxPrefixLenAttributeType) (ret RegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetMaxPrefixLenAttributeType(arg *RegionalAreaIPv4GetMaxPrefixLenAttributeType, val RegionalAreaIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isLong +type RegionalAreaIPv4GetMinPrefixLenAttributeType = *int64 +type RegionalAreaIPv4GetMinPrefixLenArgType = int64 +type RegionalAreaIPv4GetMinPrefixLenRetType = int64 + +func getRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(arg RegionalAreaIPv4GetMinPrefixLenAttributeType) (ret RegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetMinPrefixLenAttributeType(arg *RegionalAreaIPv4GetMinPrefixLenAttributeType, val RegionalAreaIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for networkRanges +*/ + +// isArray +type RegionalAreaIPv4GetNetworkRangesAttributeType = *[]NetworkRange +type RegionalAreaIPv4GetNetworkRangesArgType = []NetworkRange +type RegionalAreaIPv4GetNetworkRangesRetType = []NetworkRange + +func getRegionalAreaIPv4GetNetworkRangesAttributeTypeOk(arg RegionalAreaIPv4GetNetworkRangesAttributeType) (ret RegionalAreaIPv4GetNetworkRangesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetNetworkRangesAttributeType(arg *RegionalAreaIPv4GetNetworkRangesAttributeType, val RegionalAreaIPv4GetNetworkRangesRetType) { + *arg = &val +} + +/* + types and functions for transferNetwork +*/ + +// isNotNullableString +type RegionalAreaIPv4GetTransferNetworkAttributeType = *string + +func getRegionalAreaIPv4GetTransferNetworkAttributeTypeOk(arg RegionalAreaIPv4GetTransferNetworkAttributeType) (ret RegionalAreaIPv4GetTransferNetworkRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaIPv4GetTransferNetworkAttributeType(arg *RegionalAreaIPv4GetTransferNetworkAttributeType, val RegionalAreaIPv4GetTransferNetworkRetType) { + *arg = &val +} + +type RegionalAreaIPv4GetTransferNetworkArgType = string +type RegionalAreaIPv4GetTransferNetworkRetType = string + +// RegionalAreaIPv4 The regional IPv4 config of a network area. +type RegionalAreaIPv4 struct { + DefaultNameservers RegionalAreaIPv4GetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // The default prefix length for networks in the network area. + // REQUIRED + DefaultPrefixLen RegionalAreaIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen" required:"true"` + // The maximal prefix length for networks in the network area. + // REQUIRED + MaxPrefixLen RegionalAreaIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen" required:"true"` + // The minimal prefix length for networks in the network area. + // REQUIRED + MinPrefixLen RegionalAreaIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen" required:"true"` + // A list of network ranges. + // REQUIRED + NetworkRanges RegionalAreaIPv4GetNetworkRangesAttributeType `json:"networkRanges" required:"true"` + // IPv4 Classless Inter-Domain Routing (CIDR). + // REQUIRED + TransferNetwork RegionalAreaIPv4GetTransferNetworkAttributeType `json:"transferNetwork" required:"true"` +} + +type _RegionalAreaIPv4 RegionalAreaIPv4 + +// NewRegionalAreaIPv4 instantiates a new RegionalAreaIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegionalAreaIPv4(defaultPrefixLen RegionalAreaIPv4GetDefaultPrefixLenArgType, maxPrefixLen RegionalAreaIPv4GetMaxPrefixLenArgType, minPrefixLen RegionalAreaIPv4GetMinPrefixLenArgType, networkRanges RegionalAreaIPv4GetNetworkRangesArgType, transferNetwork RegionalAreaIPv4GetTransferNetworkArgType) *RegionalAreaIPv4 { + this := RegionalAreaIPv4{} + setRegionalAreaIPv4GetDefaultPrefixLenAttributeType(&this.DefaultPrefixLen, defaultPrefixLen) + setRegionalAreaIPv4GetMaxPrefixLenAttributeType(&this.MaxPrefixLen, maxPrefixLen) + setRegionalAreaIPv4GetMinPrefixLenAttributeType(&this.MinPrefixLen, minPrefixLen) + setRegionalAreaIPv4GetNetworkRangesAttributeType(&this.NetworkRanges, networkRanges) + setRegionalAreaIPv4GetTransferNetworkAttributeType(&this.TransferNetwork, transferNetwork) + return &this +} + +// NewRegionalAreaIPv4WithDefaults instantiates a new RegionalAreaIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegionalAreaIPv4WithDefaults() *RegionalAreaIPv4 { + this := RegionalAreaIPv4{} + var defaultPrefixLen int64 = 25 + this.DefaultPrefixLen = &defaultPrefixLen + var maxPrefixLen int64 = 29 + this.MaxPrefixLen = &maxPrefixLen + var minPrefixLen int64 = 24 + this.MinPrefixLen = &minPrefixLen + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *RegionalAreaIPv4) GetDefaultNameservers() (res RegionalAreaIPv4GetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetDefaultNameserversOk() (ret RegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + return getRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *RegionalAreaIPv4) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *RegionalAreaIPv4) SetDefaultNameservers(v RegionalAreaIPv4GetDefaultNameserversRetType) { + setRegionalAreaIPv4GetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value +func (o *RegionalAreaIPv4) GetDefaultPrefixLen() (ret RegionalAreaIPv4GetDefaultPrefixLenRetType) { + ret, _ = o.GetDefaultPrefixLenOk() + return ret +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetDefaultPrefixLenOk() (ret RegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + return getRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// SetDefaultPrefixLen sets field value +func (o *RegionalAreaIPv4) SetDefaultPrefixLen(v RegionalAreaIPv4GetDefaultPrefixLenRetType) { + setRegionalAreaIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value +func (o *RegionalAreaIPv4) GetMaxPrefixLen() (ret RegionalAreaIPv4GetMaxPrefixLenRetType) { + ret, _ = o.GetMaxPrefixLenOk() + return ret +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetMaxPrefixLenOk() (ret RegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + return getRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// SetMaxPrefixLen sets field value +func (o *RegionalAreaIPv4) SetMaxPrefixLen(v RegionalAreaIPv4GetMaxPrefixLenRetType) { + setRegionalAreaIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value +func (o *RegionalAreaIPv4) GetMinPrefixLen() (ret RegionalAreaIPv4GetMinPrefixLenRetType) { + ret, _ = o.GetMinPrefixLenOk() + return ret +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetMinPrefixLenOk() (ret RegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + return getRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// SetMinPrefixLen sets field value +func (o *RegionalAreaIPv4) SetMinPrefixLen(v RegionalAreaIPv4GetMinPrefixLenRetType) { + setRegionalAreaIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +// GetNetworkRanges returns the NetworkRanges field value +func (o *RegionalAreaIPv4) GetNetworkRanges() (ret RegionalAreaIPv4GetNetworkRangesRetType) { + ret, _ = o.GetNetworkRangesOk() + return ret +} + +// GetNetworkRangesOk returns a tuple with the NetworkRanges field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetNetworkRangesOk() (ret RegionalAreaIPv4GetNetworkRangesRetType, ok bool) { + return getRegionalAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges) +} + +// SetNetworkRanges sets field value +func (o *RegionalAreaIPv4) SetNetworkRanges(v RegionalAreaIPv4GetNetworkRangesRetType) { + setRegionalAreaIPv4GetNetworkRangesAttributeType(&o.NetworkRanges, v) +} + +// GetTransferNetwork returns the TransferNetwork field value +func (o *RegionalAreaIPv4) GetTransferNetwork() (ret RegionalAreaIPv4GetTransferNetworkRetType) { + ret, _ = o.GetTransferNetworkOk() + return ret +} + +// GetTransferNetworkOk returns a tuple with the TransferNetwork field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaIPv4) GetTransferNetworkOk() (ret RegionalAreaIPv4GetTransferNetworkRetType, ok bool) { + return getRegionalAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork) +} + +// SetTransferNetwork sets field value +func (o *RegionalAreaIPv4) SetTransferNetwork(v RegionalAreaIPv4GetTransferNetworkRetType) { + setRegionalAreaIPv4GetTransferNetworkAttributeType(&o.TransferNetwork, v) +} + +func (o RegionalAreaIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + if val, ok := getRegionalAreaIPv4GetNetworkRangesAttributeTypeOk(o.NetworkRanges); ok { + toSerialize["NetworkRanges"] = val + } + if val, ok := getRegionalAreaIPv4GetTransferNetworkAttributeTypeOk(o.TransferNetwork); ok { + toSerialize["TransferNetwork"] = val + } + return toSerialize, nil +} + +type NullableRegionalAreaIPv4 struct { + value *RegionalAreaIPv4 + isSet bool +} + +func (v NullableRegionalAreaIPv4) Get() *RegionalAreaIPv4 { + return v.value +} + +func (v *NullableRegionalAreaIPv4) Set(val *RegionalAreaIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableRegionalAreaIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionalAreaIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionalAreaIPv4(val *RegionalAreaIPv4) *NullableRegionalAreaIPv4 { + return &NullableRegionalAreaIPv4{value: val, isSet: true} +} + +func (v NullableRegionalAreaIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionalAreaIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area_list_response.go new file mode 100644 index 00000000..1c0121ce --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_regional_area_list_response.go @@ -0,0 +1,125 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RegionalAreaListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RegionalAreaListResponse{} + +/* + types and functions for regions +*/ + +// isContainer +type RegionalAreaListResponseGetRegionsAttributeType = *map[string]RegionalArea +type RegionalAreaListResponseGetRegionsArgType = map[string]RegionalArea +type RegionalAreaListResponseGetRegionsRetType = map[string]RegionalArea + +func getRegionalAreaListResponseGetRegionsAttributeTypeOk(arg RegionalAreaListResponseGetRegionsAttributeType) (ret RegionalAreaListResponseGetRegionsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRegionalAreaListResponseGetRegionsAttributeType(arg *RegionalAreaListResponseGetRegionsAttributeType, val RegionalAreaListResponseGetRegionsRetType) { + *arg = &val +} + +// RegionalAreaListResponse Regional area list response. +type RegionalAreaListResponse struct { + // REQUIRED + Regions RegionalAreaListResponseGetRegionsAttributeType `json:"regions" required:"true"` +} + +type _RegionalAreaListResponse RegionalAreaListResponse + +// NewRegionalAreaListResponse instantiates a new RegionalAreaListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRegionalAreaListResponse(regions RegionalAreaListResponseGetRegionsArgType) *RegionalAreaListResponse { + this := RegionalAreaListResponse{} + setRegionalAreaListResponseGetRegionsAttributeType(&this.Regions, regions) + return &this +} + +// NewRegionalAreaListResponseWithDefaults instantiates a new RegionalAreaListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRegionalAreaListResponseWithDefaults() *RegionalAreaListResponse { + this := RegionalAreaListResponse{} + return &this +} + +// GetRegions returns the Regions field value +func (o *RegionalAreaListResponse) GetRegions() (ret RegionalAreaListResponseGetRegionsRetType) { + ret, _ = o.GetRegionsOk() + return ret +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *RegionalAreaListResponse) GetRegionsOk() (ret RegionalAreaListResponseGetRegionsRetType, ok bool) { + return getRegionalAreaListResponseGetRegionsAttributeTypeOk(o.Regions) +} + +// SetRegions sets field value +func (o *RegionalAreaListResponse) SetRegions(v RegionalAreaListResponseGetRegionsRetType) { + setRegionalAreaListResponseGetRegionsAttributeType(&o.Regions, v) +} + +func (o RegionalAreaListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRegionalAreaListResponseGetRegionsAttributeTypeOk(o.Regions); ok { + toSerialize["Regions"] = val + } + return toSerialize, nil +} + +type NullableRegionalAreaListResponse struct { + value *RegionalAreaListResponse + isSet bool +} + +func (v NullableRegionalAreaListResponse) Get() *RegionalAreaListResponse { + return v.value +} + +func (v *NullableRegionalAreaListResponse) Set(val *RegionalAreaListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRegionalAreaListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRegionalAreaListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegionalAreaListResponse(val *RegionalAreaListResponse) *NullableRegionalAreaListResponse { + return &NullableRegionalAreaListResponse{value: val, isSet: true} +} + +func (v NullableRegionalAreaListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegionalAreaListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_request.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_request.go new file mode 100644 index 00000000..f3ef9c0e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_request.go @@ -0,0 +1,353 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the Request type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Request{} + +/* + types and functions for details +*/ + +// isNotNullableString +type RequestGetDetailsAttributeType = *string + +func getRequestGetDetailsAttributeTypeOk(arg RequestGetDetailsAttributeType) (ret RequestGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetDetailsAttributeType(arg *RequestGetDetailsAttributeType, val RequestGetDetailsRetType) { + *arg = &val +} + +type RequestGetDetailsArgType = string +type RequestGetDetailsRetType = string + +/* + types and functions for requestAction +*/ + +// isNotNullableString +type RequestGetRequestActionAttributeType = *string + +func getRequestGetRequestActionAttributeTypeOk(arg RequestGetRequestActionAttributeType) (ret RequestGetRequestActionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetRequestActionAttributeType(arg *RequestGetRequestActionAttributeType, val RequestGetRequestActionRetType) { + *arg = &val +} + +type RequestGetRequestActionArgType = string +type RequestGetRequestActionRetType = string + +/* + types and functions for requestId +*/ + +// isNotNullableString +type RequestGetRequestIdAttributeType = *string + +func getRequestGetRequestIdAttributeTypeOk(arg RequestGetRequestIdAttributeType) (ret RequestGetRequestIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetRequestIdAttributeType(arg *RequestGetRequestIdAttributeType, val RequestGetRequestIdRetType) { + *arg = &val +} + +type RequestGetRequestIdArgType = string +type RequestGetRequestIdRetType = string + +/* + types and functions for requestType +*/ + +// isNotNullableString +type RequestGetRequestTypeAttributeType = *string + +func getRequestGetRequestTypeAttributeTypeOk(arg RequestGetRequestTypeAttributeType) (ret RequestGetRequestTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetRequestTypeAttributeType(arg *RequestGetRequestTypeAttributeType, val RequestGetRequestTypeRetType) { + *arg = &val +} + +type RequestGetRequestTypeArgType = string +type RequestGetRequestTypeRetType = string + +/* + types and functions for resources +*/ + +// isArray +type RequestGetResourcesAttributeType = *[]RequestResource +type RequestGetResourcesArgType = []RequestResource +type RequestGetResourcesRetType = []RequestResource + +func getRequestGetResourcesAttributeTypeOk(arg RequestGetResourcesAttributeType) (ret RequestGetResourcesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetResourcesAttributeType(arg *RequestGetResourcesAttributeType, val RequestGetResourcesRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type RequestGetStatusAttributeType = *string + +func getRequestGetStatusAttributeTypeOk(arg RequestGetStatusAttributeType) (ret RequestGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestGetStatusAttributeType(arg *RequestGetStatusAttributeType, val RequestGetStatusRetType) { + *arg = &val +} + +type RequestGetStatusArgType = string +type RequestGetStatusRetType = string + +// Request Object that represents a request. +type Request struct { + Details RequestGetDetailsAttributeType `json:"details,omitempty"` + // Object that represents a resource action. Possible values: `CREATE`, `DELETE`, `UPDATE`. + // REQUIRED + RequestAction RequestGetRequestActionAttributeType `json:"requestAction" required:"true"` + // Identifier (ID) representing a single API request. + // REQUIRED + RequestId RequestGetRequestIdAttributeType `json:"requestId" required:"true"` + // Object that represents a resource type. Possible values: `BACKUP`, `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + // REQUIRED + RequestType RequestGetRequestTypeAttributeType `json:"requestType" required:"true"` + // REQUIRED + Resources RequestGetResourcesAttributeType `json:"resources" required:"true"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status RequestGetStatusAttributeType `json:"status" required:"true"` +} + +type _Request Request + +// NewRequest instantiates a new Request object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRequest(requestAction RequestGetRequestActionArgType, requestId RequestGetRequestIdArgType, requestType RequestGetRequestTypeArgType, resources RequestGetResourcesArgType, status RequestGetStatusArgType) *Request { + this := Request{} + setRequestGetRequestActionAttributeType(&this.RequestAction, requestAction) + setRequestGetRequestIdAttributeType(&this.RequestId, requestId) + setRequestGetRequestTypeAttributeType(&this.RequestType, requestType) + setRequestGetResourcesAttributeType(&this.Resources, resources) + setRequestGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewRequestWithDefaults instantiates a new Request object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRequestWithDefaults() *Request { + this := Request{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *Request) GetDetails() (res RequestGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Request) GetDetailsOk() (ret RequestGetDetailsRetType, ok bool) { + return getRequestGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *Request) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *Request) SetDetails(v RequestGetDetailsRetType) { + setRequestGetDetailsAttributeType(&o.Details, v) +} + +// GetRequestAction returns the RequestAction field value +func (o *Request) GetRequestAction() (ret RequestGetRequestActionRetType) { + ret, _ = o.GetRequestActionOk() + return ret +} + +// GetRequestActionOk returns a tuple with the RequestAction field value +// and a boolean to check if the value has been set. +func (o *Request) GetRequestActionOk() (ret RequestGetRequestActionRetType, ok bool) { + return getRequestGetRequestActionAttributeTypeOk(o.RequestAction) +} + +// SetRequestAction sets field value +func (o *Request) SetRequestAction(v RequestGetRequestActionRetType) { + setRequestGetRequestActionAttributeType(&o.RequestAction, v) +} + +// GetRequestId returns the RequestId field value +func (o *Request) GetRequestId() (ret RequestGetRequestIdRetType) { + ret, _ = o.GetRequestIdOk() + return ret +} + +// GetRequestIdOk returns a tuple with the RequestId field value +// and a boolean to check if the value has been set. +func (o *Request) GetRequestIdOk() (ret RequestGetRequestIdRetType, ok bool) { + return getRequestGetRequestIdAttributeTypeOk(o.RequestId) +} + +// SetRequestId sets field value +func (o *Request) SetRequestId(v RequestGetRequestIdRetType) { + setRequestGetRequestIdAttributeType(&o.RequestId, v) +} + +// GetRequestType returns the RequestType field value +func (o *Request) GetRequestType() (ret RequestGetRequestTypeRetType) { + ret, _ = o.GetRequestTypeOk() + return ret +} + +// GetRequestTypeOk returns a tuple with the RequestType field value +// and a boolean to check if the value has been set. +func (o *Request) GetRequestTypeOk() (ret RequestGetRequestTypeRetType, ok bool) { + return getRequestGetRequestTypeAttributeTypeOk(o.RequestType) +} + +// SetRequestType sets field value +func (o *Request) SetRequestType(v RequestGetRequestTypeRetType) { + setRequestGetRequestTypeAttributeType(&o.RequestType, v) +} + +// GetResources returns the Resources field value +func (o *Request) GetResources() (ret RequestGetResourcesRetType) { + ret, _ = o.GetResourcesOk() + return ret +} + +// GetResourcesOk returns a tuple with the Resources field value +// and a boolean to check if the value has been set. +func (o *Request) GetResourcesOk() (ret RequestGetResourcesRetType, ok bool) { + return getRequestGetResourcesAttributeTypeOk(o.Resources) +} + +// SetResources sets field value +func (o *Request) SetResources(v RequestGetResourcesRetType) { + setRequestGetResourcesAttributeType(&o.Resources, v) +} + +// GetStatus returns the Status field value +func (o *Request) GetStatus() (ret RequestGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *Request) GetStatusOk() (ret RequestGetStatusRetType, ok bool) { + return getRequestGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *Request) SetStatus(v RequestGetStatusRetType) { + setRequestGetStatusAttributeType(&o.Status, v) +} + +func (o Request) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRequestGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getRequestGetRequestActionAttributeTypeOk(o.RequestAction); ok { + toSerialize["RequestAction"] = val + } + if val, ok := getRequestGetRequestIdAttributeTypeOk(o.RequestId); ok { + toSerialize["RequestId"] = val + } + if val, ok := getRequestGetRequestTypeAttributeTypeOk(o.RequestType); ok { + toSerialize["RequestType"] = val + } + if val, ok := getRequestGetResourcesAttributeTypeOk(o.Resources); ok { + toSerialize["Resources"] = val + } + if val, ok := getRequestGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableRequest struct { + value *Request + isSet bool +} + +func (v NullableRequest) Get() *Request { + return v.value +} + +func (v *NullableRequest) Set(val *Request) { + v.value = val + v.isSet = true +} + +func (v NullableRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequest(val *Request) *NullableRequest { + return &NullableRequest{value: val, isSet: true} +} + +func (v NullableRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_request_resource.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_request_resource.go new file mode 100644 index 00000000..585ce793 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_request_resource.go @@ -0,0 +1,217 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RequestResource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestResource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type RequestResourceGetIdAttributeType = *string + +func getRequestResourceGetIdAttributeTypeOk(arg RequestResourceGetIdAttributeType) (ret RequestResourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestResourceGetIdAttributeType(arg *RequestResourceGetIdAttributeType, val RequestResourceGetIdRetType) { + *arg = &val +} + +type RequestResourceGetIdArgType = string +type RequestResourceGetIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type RequestResourceGetStatusAttributeType = *string + +func getRequestResourceGetStatusAttributeTypeOk(arg RequestResourceGetStatusAttributeType) (ret RequestResourceGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestResourceGetStatusAttributeType(arg *RequestResourceGetStatusAttributeType, val RequestResourceGetStatusRetType) { + *arg = &val +} + +type RequestResourceGetStatusArgType = string +type RequestResourceGetStatusRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type RequestResourceGetTypeAttributeType = *string + +func getRequestResourceGetTypeAttributeTypeOk(arg RequestResourceGetTypeAttributeType) (ret RequestResourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRequestResourceGetTypeAttributeType(arg *RequestResourceGetTypeAttributeType, val RequestResourceGetTypeRetType) { + *arg = &val +} + +type RequestResourceGetTypeArgType = string +type RequestResourceGetTypeRetType = string + +// RequestResource Object that represents a resource as part of a request. +type RequestResource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id RequestResourceGetIdAttributeType `json:"id" required:"true"` + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. + // REQUIRED + Status RequestResourceGetStatusAttributeType `json:"status" required:"true"` + // Object that represents a resource type. Possible values: `BACKUP`, `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. + // REQUIRED + Type RequestResourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _RequestResource RequestResource + +// NewRequestResource instantiates a new RequestResource object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRequestResource(id RequestResourceGetIdArgType, status RequestResourceGetStatusArgType, types RequestResourceGetTypeArgType) *RequestResource { + this := RequestResource{} + setRequestResourceGetIdAttributeType(&this.Id, id) + setRequestResourceGetStatusAttributeType(&this.Status, status) + setRequestResourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewRequestResourceWithDefaults instantiates a new RequestResource object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRequestResourceWithDefaults() *RequestResource { + this := RequestResource{} + return &this +} + +// GetId returns the Id field value +func (o *RequestResource) GetId() (ret RequestResourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RequestResource) GetIdOk() (ret RequestResourceGetIdRetType, ok bool) { + return getRequestResourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *RequestResource) SetId(v RequestResourceGetIdRetType) { + setRequestResourceGetIdAttributeType(&o.Id, v) +} + +// GetStatus returns the Status field value +func (o *RequestResource) GetStatus() (ret RequestResourceGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *RequestResource) GetStatusOk() (ret RequestResourceGetStatusRetType, ok bool) { + return getRequestResourceGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *RequestResource) SetStatus(v RequestResourceGetStatusRetType) { + setRequestResourceGetStatusAttributeType(&o.Status, v) +} + +// GetType returns the Type field value +func (o *RequestResource) GetType() (ret RequestResourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RequestResource) GetTypeOk() (ret RequestResourceGetTypeRetType, ok bool) { + return getRequestResourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *RequestResource) SetType(v RequestResourceGetTypeRetType) { + setRequestResourceGetTypeAttributeType(&o.Type, v) +} + +func (o RequestResource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRequestResourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRequestResourceGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getRequestResourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableRequestResource struct { + value *RequestResource + isSet bool +} + +func (v NullableRequestResource) Get() *RequestResource { + return v.value +} + +func (v *NullableRequestResource) Set(val *RequestResource) { + v.value = val + v.isSet = true +} + +func (v NullableRequestResource) IsSet() bool { + return v.isSet +} + +func (v *NullableRequestResource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRequestResource(val *RequestResource) *NullableRequestResource { + return &NullableRequestResource{value: val, isSet: true} +} + +func (v NullableRequestResource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRequestResource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_rescue_server_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_rescue_server_payload.go new file mode 100644 index 00000000..973b2271 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_rescue_server_payload.go @@ -0,0 +1,127 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RescueServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RescueServerPayload{} + +/* + types and functions for image +*/ + +// isNotNullableString +type RescueServerPayloadGetImageAttributeType = *string + +func getRescueServerPayloadGetImageAttributeTypeOk(arg RescueServerPayloadGetImageAttributeType) (ret RescueServerPayloadGetImageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRescueServerPayloadGetImageAttributeType(arg *RescueServerPayloadGetImageAttributeType, val RescueServerPayloadGetImageRetType) { + *arg = &val +} + +type RescueServerPayloadGetImageArgType = string +type RescueServerPayloadGetImageRetType = string + +// RescueServerPayload struct for RescueServerPayload +type RescueServerPayload struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Image RescueServerPayloadGetImageAttributeType `json:"image" required:"true"` +} + +type _RescueServerPayload RescueServerPayload + +// NewRescueServerPayload instantiates a new RescueServerPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRescueServerPayload(image RescueServerPayloadGetImageArgType) *RescueServerPayload { + this := RescueServerPayload{} + setRescueServerPayloadGetImageAttributeType(&this.Image, image) + return &this +} + +// NewRescueServerPayloadWithDefaults instantiates a new RescueServerPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRescueServerPayloadWithDefaults() *RescueServerPayload { + this := RescueServerPayload{} + return &this +} + +// GetImage returns the Image field value +func (o *RescueServerPayload) GetImage() (ret RescueServerPayloadGetImageRetType) { + ret, _ = o.GetImageOk() + return ret +} + +// GetImageOk returns a tuple with the Image field value +// and a boolean to check if the value has been set. +func (o *RescueServerPayload) GetImageOk() (ret RescueServerPayloadGetImageRetType, ok bool) { + return getRescueServerPayloadGetImageAttributeTypeOk(o.Image) +} + +// SetImage sets field value +func (o *RescueServerPayload) SetImage(v RescueServerPayloadGetImageRetType) { + setRescueServerPayloadGetImageAttributeType(&o.Image, v) +} + +func (o RescueServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRescueServerPayloadGetImageAttributeTypeOk(o.Image); ok { + toSerialize["Image"] = val + } + return toSerialize, nil +} + +type NullableRescueServerPayload struct { + value *RescueServerPayload + isSet bool +} + +func (v NullableRescueServerPayload) Get() *RescueServerPayload { + return v.value +} + +func (v *NullableRescueServerPayload) Set(val *RescueServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableRescueServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableRescueServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRescueServerPayload(val *RescueServerPayload) *NullableRescueServerPayload { + return &NullableRescueServerPayload{value: val, isSet: true} +} + +func (v NullableRescueServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRescueServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_resize_server_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_resize_server_payload.go new file mode 100644 index 00000000..de2742b3 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_resize_server_payload.go @@ -0,0 +1,127 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ResizeServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResizeServerPayload{} + +/* + types and functions for machineType +*/ + +// isNotNullableString +type ResizeServerPayloadGetMachineTypeAttributeType = *string + +func getResizeServerPayloadGetMachineTypeAttributeTypeOk(arg ResizeServerPayloadGetMachineTypeAttributeType) (ret ResizeServerPayloadGetMachineTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResizeServerPayloadGetMachineTypeAttributeType(arg *ResizeServerPayloadGetMachineTypeAttributeType, val ResizeServerPayloadGetMachineTypeRetType) { + *arg = &val +} + +type ResizeServerPayloadGetMachineTypeArgType = string +type ResizeServerPayloadGetMachineTypeRetType = string + +// ResizeServerPayload struct for ResizeServerPayload +type ResizeServerPayload struct { + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType ResizeServerPayloadGetMachineTypeAttributeType `json:"machineType" required:"true"` +} + +type _ResizeServerPayload ResizeServerPayload + +// NewResizeServerPayload instantiates a new ResizeServerPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewResizeServerPayload(machineType ResizeServerPayloadGetMachineTypeArgType) *ResizeServerPayload { + this := ResizeServerPayload{} + setResizeServerPayloadGetMachineTypeAttributeType(&this.MachineType, machineType) + return &this +} + +// NewResizeServerPayloadWithDefaults instantiates a new ResizeServerPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewResizeServerPayloadWithDefaults() *ResizeServerPayload { + this := ResizeServerPayload{} + return &this +} + +// GetMachineType returns the MachineType field value +func (o *ResizeServerPayload) GetMachineType() (ret ResizeServerPayloadGetMachineTypeRetType) { + ret, _ = o.GetMachineTypeOk() + return ret +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *ResizeServerPayload) GetMachineTypeOk() (ret ResizeServerPayloadGetMachineTypeRetType, ok bool) { + return getResizeServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType) +} + +// SetMachineType sets field value +func (o *ResizeServerPayload) SetMachineType(v ResizeServerPayloadGetMachineTypeRetType) { + setResizeServerPayloadGetMachineTypeAttributeType(&o.MachineType, v) +} + +func (o ResizeServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResizeServerPayloadGetMachineTypeAttributeTypeOk(o.MachineType); ok { + toSerialize["MachineType"] = val + } + return toSerialize, nil +} + +type NullableResizeServerPayload struct { + value *ResizeServerPayload + isSet bool +} + +func (v NullableResizeServerPayload) Get() *ResizeServerPayload { + return v.value +} + +func (v *NullableResizeServerPayload) Set(val *ResizeServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableResizeServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableResizeServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResizeServerPayload(val *ResizeServerPayload) *NullableResizeServerPayload { + return &NullableResizeServerPayload{value: val, isSet: true} +} + +func (v NullableResizeServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResizeServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_resize_volume_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_resize_volume_payload.go new file mode 100644 index 00000000..1e5e604a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_resize_volume_payload.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ResizeVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResizeVolumePayload{} + +/* + types and functions for size +*/ + +// isLong +type ResizeVolumePayloadGetSizeAttributeType = *int64 +type ResizeVolumePayloadGetSizeArgType = int64 +type ResizeVolumePayloadGetSizeRetType = int64 + +func getResizeVolumePayloadGetSizeAttributeTypeOk(arg ResizeVolumePayloadGetSizeAttributeType) (ret ResizeVolumePayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setResizeVolumePayloadGetSizeAttributeType(arg *ResizeVolumePayloadGetSizeAttributeType, val ResizeVolumePayloadGetSizeRetType) { + *arg = &val +} + +// ResizeVolumePayload struct for ResizeVolumePayload +type ResizeVolumePayload struct { + // Size in Gigabyte. + // REQUIRED + Size ResizeVolumePayloadGetSizeAttributeType `json:"size" required:"true"` +} + +type _ResizeVolumePayload ResizeVolumePayload + +// NewResizeVolumePayload instantiates a new ResizeVolumePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewResizeVolumePayload(size ResizeVolumePayloadGetSizeArgType) *ResizeVolumePayload { + this := ResizeVolumePayload{} + setResizeVolumePayloadGetSizeAttributeType(&this.Size, size) + return &this +} + +// NewResizeVolumePayloadWithDefaults instantiates a new ResizeVolumePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewResizeVolumePayloadWithDefaults() *ResizeVolumePayload { + this := ResizeVolumePayload{} + return &this +} + +// GetSize returns the Size field value +func (o *ResizeVolumePayload) GetSize() (ret ResizeVolumePayloadGetSizeRetType) { + ret, _ = o.GetSizeOk() + return ret +} + +// GetSizeOk returns a tuple with the Size field value +// and a boolean to check if the value has been set. +func (o *ResizeVolumePayload) GetSizeOk() (ret ResizeVolumePayloadGetSizeRetType, ok bool) { + return getResizeVolumePayloadGetSizeAttributeTypeOk(o.Size) +} + +// SetSize sets field value +func (o *ResizeVolumePayload) SetSize(v ResizeVolumePayloadGetSizeRetType) { + setResizeVolumePayloadGetSizeAttributeType(&o.Size, v) +} + +func (o ResizeVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getResizeVolumePayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + return toSerialize, nil +} + +type NullableResizeVolumePayload struct { + value *ResizeVolumePayload + isSet bool +} + +func (v NullableResizeVolumePayload) Get() *ResizeVolumePayload { + return v.value +} + +func (v *NullableResizeVolumePayload) Set(val *ResizeVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableResizeVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableResizeVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResizeVolumePayload(val *ResizeVolumePayload) *NullableResizeVolumePayload { + return &NullableResizeVolumePayload{value: val, isSet: true} +} + +func (v NullableResizeVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResizeVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route.go new file mode 100644 index 00000000..76af1058 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route.go @@ -0,0 +1,362 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Route type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Route{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type RouteGetCreatedAtAttributeType = *time.Time +type RouteGetCreatedAtArgType = time.Time +type RouteGetCreatedAtRetType = time.Time + +func getRouteGetCreatedAtAttributeTypeOk(arg RouteGetCreatedAtAttributeType) (ret RouteGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetCreatedAtAttributeType(arg *RouteGetCreatedAtAttributeType, val RouteGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for destination +*/ + +// isModel +type RouteGetDestinationAttributeType = *RouteDestination +type RouteGetDestinationArgType = RouteDestination +type RouteGetDestinationRetType = RouteDestination + +func getRouteGetDestinationAttributeTypeOk(arg RouteGetDestinationAttributeType) (ret RouteGetDestinationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetDestinationAttributeType(arg *RouteGetDestinationAttributeType, val RouteGetDestinationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RouteGetIdAttributeType = *string + +func getRouteGetIdAttributeTypeOk(arg RouteGetIdAttributeType) (ret RouteGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetIdAttributeType(arg *RouteGetIdAttributeType, val RouteGetIdRetType) { + *arg = &val +} + +type RouteGetIdArgType = string +type RouteGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type RouteGetLabelsAttributeType = *map[string]interface{} +type RouteGetLabelsArgType = map[string]interface{} +type RouteGetLabelsRetType = map[string]interface{} + +func getRouteGetLabelsAttributeTypeOk(arg RouteGetLabelsAttributeType) (ret RouteGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetLabelsAttributeType(arg *RouteGetLabelsAttributeType, val RouteGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for nexthop +*/ + +// isModel +type RouteGetNexthopAttributeType = *RouteNexthop +type RouteGetNexthopArgType = RouteNexthop +type RouteGetNexthopRetType = RouteNexthop + +func getRouteGetNexthopAttributeTypeOk(arg RouteGetNexthopAttributeType) (ret RouteGetNexthopRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetNexthopAttributeType(arg *RouteGetNexthopAttributeType, val RouteGetNexthopRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type RouteGetUpdatedAtAttributeType = *time.Time +type RouteGetUpdatedAtArgType = time.Time +type RouteGetUpdatedAtRetType = time.Time + +func getRouteGetUpdatedAtAttributeTypeOk(arg RouteGetUpdatedAtAttributeType) (ret RouteGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteGetUpdatedAtAttributeType(arg *RouteGetUpdatedAtAttributeType, val RouteGetUpdatedAtRetType) { + *arg = &val +} + +// Route Object represents a network route. +type Route struct { + // Date-time when resource was created. + CreatedAt RouteGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // REQUIRED + Destination RouteGetDestinationAttributeType `json:"destination" required:"true"` + // Universally Unique Identifier (UUID). + Id RouteGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels RouteGetLabelsAttributeType `json:"labels,omitempty"` + // REQUIRED + Nexthop RouteGetNexthopAttributeType `json:"nexthop" required:"true"` + // Date-time when resource was last updated. + UpdatedAt RouteGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Route Route + +// NewRoute instantiates a new Route object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRoute(destination RouteGetDestinationArgType, nexthop RouteGetNexthopArgType) *Route { + this := Route{} + setRouteGetDestinationAttributeType(&this.Destination, destination) + setRouteGetNexthopAttributeType(&this.Nexthop, nexthop) + return &this +} + +// NewRouteWithDefaults instantiates a new Route object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRouteWithDefaults() *Route { + this := Route{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Route) GetCreatedAt() (res RouteGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetCreatedAtOk() (ret RouteGetCreatedAtRetType, ok bool) { + return getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Route) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Route) SetCreatedAt(v RouteGetCreatedAtRetType) { + setRouteGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDestination returns the Destination field value +func (o *Route) GetDestination() (ret RouteGetDestinationRetType) { + ret, _ = o.GetDestinationOk() + return ret +} + +// GetDestinationOk returns a tuple with the Destination field value +// and a boolean to check if the value has been set. +func (o *Route) GetDestinationOk() (ret RouteGetDestinationRetType, ok bool) { + return getRouteGetDestinationAttributeTypeOk(o.Destination) +} + +// SetDestination sets field value +func (o *Route) SetDestination(v RouteGetDestinationRetType) { + setRouteGetDestinationAttributeType(&o.Destination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Route) GetId() (res RouteGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetIdOk() (ret RouteGetIdRetType, ok bool) { + return getRouteGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Route) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Route) SetId(v RouteGetIdRetType) { + setRouteGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Route) GetLabels() (res RouteGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetLabelsOk() (ret RouteGetLabelsRetType, ok bool) { + return getRouteGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Route) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Route) SetLabels(v RouteGetLabelsRetType) { + setRouteGetLabelsAttributeType(&o.Labels, v) +} + +// GetNexthop returns the Nexthop field value +func (o *Route) GetNexthop() (ret RouteGetNexthopRetType) { + ret, _ = o.GetNexthopOk() + return ret +} + +// GetNexthopOk returns a tuple with the Nexthop field value +// and a boolean to check if the value has been set. +func (o *Route) GetNexthopOk() (ret RouteGetNexthopRetType, ok bool) { + return getRouteGetNexthopAttributeTypeOk(o.Nexthop) +} + +// SetNexthop sets field value +func (o *Route) SetNexthop(v RouteGetNexthopRetType) { + setRouteGetNexthopAttributeType(&o.Nexthop, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Route) GetUpdatedAt() (res RouteGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Route) GetUpdatedAtOk() (ret RouteGetUpdatedAtRetType, ok bool) { + return getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Route) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Route) SetUpdatedAt(v RouteGetUpdatedAtRetType) { + setRouteGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Route) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRouteGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRouteGetDestinationAttributeTypeOk(o.Destination); ok { + toSerialize["Destination"] = val + } + if val, ok := getRouteGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRouteGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRouteGetNexthopAttributeTypeOk(o.Nexthop); ok { + toSerialize["Nexthop"] = val + } + if val, ok := getRouteGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableRoute struct { + value *Route + isSet bool +} + +func (v NullableRoute) Get() *Route { + return v.value +} + +func (v *NullableRoute) Set(val *Route) { + v.value = val + v.isSet = true +} + +func (v NullableRoute) IsSet() bool { + return v.isSet +} + +func (v *NullableRoute) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoute(val *Route) *NullableRoute { + return &NullableRoute{value: val, isSet: true} +} + +func (v NullableRoute) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoute) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_destination.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_destination.go new file mode 100644 index 00000000..2411d3a3 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_destination.go @@ -0,0 +1,163 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// RouteDestination - struct for RouteDestination +type RouteDestination struct { + DestinationCIDRv4 *DestinationCIDRv4 + DestinationCIDRv6 *DestinationCIDRv6 +} + +// DestinationCIDRv4AsRouteDestination is a convenience function that returns DestinationCIDRv4 wrapped in RouteDestination +func DestinationCIDRv4AsRouteDestination(v *DestinationCIDRv4) RouteDestination { + return RouteDestination{ + DestinationCIDRv4: v, + } +} + +// DestinationCIDRv6AsRouteDestination is a convenience function that returns DestinationCIDRv6 wrapped in RouteDestination +func DestinationCIDRv6AsRouteDestination(v *DestinationCIDRv6) RouteDestination { + return RouteDestination{ + DestinationCIDRv6: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RouteDestination) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'DestinationCIDRv4' + if jsonDict["type"] == "DestinationCIDRv4" { + // try to unmarshal JSON data into DestinationCIDRv4 + err = json.Unmarshal(data, &dst.DestinationCIDRv4) + if err == nil { + return nil // data stored in dst.DestinationCIDRv4, return on the first match + } else { + dst.DestinationCIDRv4 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'DestinationCIDRv6' + if jsonDict["type"] == "DestinationCIDRv6" { + // try to unmarshal JSON data into DestinationCIDRv6 + err = json.Unmarshal(data, &dst.DestinationCIDRv6) + if err == nil { + return nil // data stored in dst.DestinationCIDRv6, return on the first match + } else { + dst.DestinationCIDRv6 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error()) + } + } + + // check if the discriminator value is 'cidrv4' + if jsonDict["type"] == "cidrv4" { + // try to unmarshal JSON data into DestinationCIDRv4 + err = json.Unmarshal(data, &dst.DestinationCIDRv4) + if err == nil { + return nil // data stored in dst.DestinationCIDRv4, return on the first match + } else { + dst.DestinationCIDRv4 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'cidrv6' + if jsonDict["type"] == "cidrv6" { + // try to unmarshal JSON data into DestinationCIDRv6 + err = json.Unmarshal(data, &dst.DestinationCIDRv6) + if err == nil { + return nil // data stored in dst.DestinationCIDRv6, return on the first match + } else { + dst.DestinationCIDRv6 = nil + return fmt.Errorf("failed to unmarshal RouteDestination as DestinationCIDRv6: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RouteDestination) MarshalJSON() ([]byte, error) { + if src.DestinationCIDRv4 != nil { + return json.Marshal(&src.DestinationCIDRv4) + } + + if src.DestinationCIDRv6 != nil { + return json.Marshal(&src.DestinationCIDRv6) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *RouteDestination) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.DestinationCIDRv4 != nil { + return obj.DestinationCIDRv4 + } + + if obj.DestinationCIDRv6 != nil { + return obj.DestinationCIDRv6 + } + + // all schemas are nil + return nil +} + +type NullableRouteDestination struct { + value *RouteDestination + isSet bool +} + +func (v NullableRouteDestination) Get() *RouteDestination { + return v.value +} + +func (v *NullableRouteDestination) Set(val *RouteDestination) { + v.value = val + v.isSet = true +} + +func (v NullableRouteDestination) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteDestination) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteDestination(val *RouteDestination) *NullableRouteDestination { + return &NullableRouteDestination{value: val, isSet: true} +} + +func (v NullableRouteDestination) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteDestination) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_list_response.go new file mode 100644 index 00000000..abcafabc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RouteListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RouteListResponse{} + +/* + types and functions for items +*/ + +// isArray +type RouteListResponseGetItemsAttributeType = *[]Route +type RouteListResponseGetItemsArgType = []Route +type RouteListResponseGetItemsRetType = []Route + +func getRouteListResponseGetItemsAttributeTypeOk(arg RouteListResponseGetItemsAttributeType) (ret RouteListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRouteListResponseGetItemsAttributeType(arg *RouteListResponseGetItemsAttributeType, val RouteListResponseGetItemsRetType) { + *arg = &val +} + +// RouteListResponse Route list response. +type RouteListResponse struct { + // A list of routes. + // REQUIRED + Items RouteListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _RouteListResponse RouteListResponse + +// NewRouteListResponse instantiates a new RouteListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRouteListResponse(items RouteListResponseGetItemsArgType) *RouteListResponse { + this := RouteListResponse{} + setRouteListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRouteListResponseWithDefaults instantiates a new RouteListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRouteListResponseWithDefaults() *RouteListResponse { + this := RouteListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *RouteListResponse) GetItems() (ret RouteListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RouteListResponse) GetItemsOk() (ret RouteListResponseGetItemsRetType, ok bool) { + return getRouteListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RouteListResponse) SetItems(v RouteListResponseGetItemsRetType) { + setRouteListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o RouteListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRouteListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRouteListResponse struct { + value *RouteListResponse + isSet bool +} + +func (v NullableRouteListResponse) Get() *RouteListResponse { + return v.value +} + +func (v *NullableRouteListResponse) Set(val *RouteListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRouteListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteListResponse(val *RouteListResponse) *NullableRouteListResponse { + return &NullableRouteListResponse{value: val, isSet: true} +} + +func (v NullableRouteListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_nexthop.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_nexthop.go new file mode 100644 index 00000000..9eaab5df --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_route_nexthop.go @@ -0,0 +1,243 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// RouteNexthop - struct for RouteNexthop +type RouteNexthop struct { + NexthopBlackhole *NexthopBlackhole + NexthopIPv4 *NexthopIPv4 + NexthopIPv6 *NexthopIPv6 + NexthopInternet *NexthopInternet +} + +// NexthopBlackholeAsRouteNexthop is a convenience function that returns NexthopBlackhole wrapped in RouteNexthop +func NexthopBlackholeAsRouteNexthop(v *NexthopBlackhole) RouteNexthop { + return RouteNexthop{ + NexthopBlackhole: v, + } +} + +// NexthopIPv4AsRouteNexthop is a convenience function that returns NexthopIPv4 wrapped in RouteNexthop +func NexthopIPv4AsRouteNexthop(v *NexthopIPv4) RouteNexthop { + return RouteNexthop{ + NexthopIPv4: v, + } +} + +// NexthopIPv6AsRouteNexthop is a convenience function that returns NexthopIPv6 wrapped in RouteNexthop +func NexthopIPv6AsRouteNexthop(v *NexthopIPv6) RouteNexthop { + return RouteNexthop{ + NexthopIPv6: v, + } +} + +// NexthopInternetAsRouteNexthop is a convenience function that returns NexthopInternet wrapped in RouteNexthop +func NexthopInternetAsRouteNexthop(v *NexthopInternet) RouteNexthop { + return RouteNexthop{ + NexthopInternet: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *RouteNexthop) UnmarshalJSON(data []byte) error { + var err error + // use discriminator value to speed up the lookup + var jsonDict map[string]interface{} + err = newStrictDecoder(data).Decode(&jsonDict) + if err != nil { + return fmt.Errorf("failed to unmarshal JSON into map for the discriminator lookup") + } + + // check if the discriminator value is 'NexthopBlackhole' + if jsonDict["type"] == "NexthopBlackhole" { + // try to unmarshal JSON data into NexthopBlackhole + err = json.Unmarshal(data, &dst.NexthopBlackhole) + if err == nil { + return nil // data stored in dst.NexthopBlackhole, return on the first match + } else { + dst.NexthopBlackhole = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopIPv4' + if jsonDict["type"] == "NexthopIPv4" { + // try to unmarshal JSON data into NexthopIPv4 + err = json.Unmarshal(data, &dst.NexthopIPv4) + if err == nil { + return nil // data stored in dst.NexthopIPv4, return on the first match + } else { + dst.NexthopIPv4 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopIPv6' + if jsonDict["type"] == "NexthopIPv6" { + // try to unmarshal JSON data into NexthopIPv6 + err = json.Unmarshal(data, &dst.NexthopIPv6) + if err == nil { + return nil // data stored in dst.NexthopIPv6, return on the first match + } else { + dst.NexthopIPv6 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error()) + } + } + + // check if the discriminator value is 'NexthopInternet' + if jsonDict["type"] == "NexthopInternet" { + // try to unmarshal JSON data into NexthopInternet + err = json.Unmarshal(data, &dst.NexthopInternet) + if err == nil { + return nil // data stored in dst.NexthopInternet, return on the first match + } else { + dst.NexthopInternet = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error()) + } + } + + // check if the discriminator value is 'blackhole' + if jsonDict["type"] == "blackhole" { + // try to unmarshal JSON data into NexthopBlackhole + err = json.Unmarshal(data, &dst.NexthopBlackhole) + if err == nil { + return nil // data stored in dst.NexthopBlackhole, return on the first match + } else { + dst.NexthopBlackhole = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopBlackhole: %s", err.Error()) + } + } + + // check if the discriminator value is 'internet' + if jsonDict["type"] == "internet" { + // try to unmarshal JSON data into NexthopInternet + err = json.Unmarshal(data, &dst.NexthopInternet) + if err == nil { + return nil // data stored in dst.NexthopInternet, return on the first match + } else { + dst.NexthopInternet = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopInternet: %s", err.Error()) + } + } + + // check if the discriminator value is 'ipv4' + if jsonDict["type"] == "ipv4" { + // try to unmarshal JSON data into NexthopIPv4 + err = json.Unmarshal(data, &dst.NexthopIPv4) + if err == nil { + return nil // data stored in dst.NexthopIPv4, return on the first match + } else { + dst.NexthopIPv4 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv4: %s", err.Error()) + } + } + + // check if the discriminator value is 'ipv6' + if jsonDict["type"] == "ipv6" { + // try to unmarshal JSON data into NexthopIPv6 + err = json.Unmarshal(data, &dst.NexthopIPv6) + if err == nil { + return nil // data stored in dst.NexthopIPv6, return on the first match + } else { + dst.NexthopIPv6 = nil + return fmt.Errorf("failed to unmarshal RouteNexthop as NexthopIPv6: %s", err.Error()) + } + } + + return nil +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src RouteNexthop) MarshalJSON() ([]byte, error) { + if src.NexthopBlackhole != nil { + return json.Marshal(&src.NexthopBlackhole) + } + + if src.NexthopIPv4 != nil { + return json.Marshal(&src.NexthopIPv4) + } + + if src.NexthopIPv6 != nil { + return json.Marshal(&src.NexthopIPv6) + } + + if src.NexthopInternet != nil { + return json.Marshal(&src.NexthopInternet) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *RouteNexthop) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.NexthopBlackhole != nil { + return obj.NexthopBlackhole + } + + if obj.NexthopIPv4 != nil { + return obj.NexthopIPv4 + } + + if obj.NexthopIPv6 != nil { + return obj.NexthopIPv6 + } + + if obj.NexthopInternet != nil { + return obj.NexthopInternet + } + + // all schemas are nil + return nil +} + +type NullableRouteNexthop struct { + value *RouteNexthop + isSet bool +} + +func (v NullableRouteNexthop) Get() *RouteNexthop { + return v.value +} + +func (v *NullableRouteNexthop) Set(val *RouteNexthop) { + v.value = val + v.isSet = true +} + +func (v NullableRouteNexthop) IsSet() bool { + return v.isSet +} + +func (v *NullableRouteNexthop) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRouteNexthop(val *RouteNexthop) *NullableRouteNexthop { + return &NullableRouteNexthop{value: val, isSet: true} +} + +func (v NullableRouteNexthop) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRouteNexthop) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_routing_table.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_routing_table.go new file mode 100644 index 00000000..db4983a0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_routing_table.go @@ -0,0 +1,517 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the RoutingTable type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RoutingTable{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type RoutingTableGetCreatedAtAttributeType = *time.Time +type RoutingTableGetCreatedAtArgType = time.Time +type RoutingTableGetCreatedAtRetType = time.Time + +func getRoutingTableGetCreatedAtAttributeTypeOk(arg RoutingTableGetCreatedAtAttributeType) (ret RoutingTableGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetCreatedAtAttributeType(arg *RoutingTableGetCreatedAtAttributeType, val RoutingTableGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for default +*/ + +// isBoolean +type RoutingTablegetDefaultAttributeType = *bool +type RoutingTablegetDefaultArgType = bool +type RoutingTablegetDefaultRetType = bool + +func getRoutingTablegetDefaultAttributeTypeOk(arg RoutingTablegetDefaultAttributeType) (ret RoutingTablegetDefaultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetDefaultAttributeType(arg *RoutingTablegetDefaultAttributeType, val RoutingTablegetDefaultRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type RoutingTableGetDescriptionAttributeType = *string + +func getRoutingTableGetDescriptionAttributeTypeOk(arg RoutingTableGetDescriptionAttributeType) (ret RoutingTableGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetDescriptionAttributeType(arg *RoutingTableGetDescriptionAttributeType, val RoutingTableGetDescriptionRetType) { + *arg = &val +} + +type RoutingTableGetDescriptionArgType = string +type RoutingTableGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type RoutingTablegetDynamicRoutesAttributeType = *bool +type RoutingTablegetDynamicRoutesArgType = bool +type RoutingTablegetDynamicRoutesRetType = bool + +func getRoutingTablegetDynamicRoutesAttributeTypeOk(arg RoutingTablegetDynamicRoutesAttributeType) (ret RoutingTablegetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetDynamicRoutesAttributeType(arg *RoutingTablegetDynamicRoutesAttributeType, val RoutingTablegetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type RoutingTableGetIdAttributeType = *string + +func getRoutingTableGetIdAttributeTypeOk(arg RoutingTableGetIdAttributeType) (ret RoutingTableGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetIdAttributeType(arg *RoutingTableGetIdAttributeType, val RoutingTableGetIdRetType) { + *arg = &val +} + +type RoutingTableGetIdArgType = string +type RoutingTableGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type RoutingTableGetLabelsAttributeType = *map[string]interface{} +type RoutingTableGetLabelsArgType = map[string]interface{} +type RoutingTableGetLabelsRetType = map[string]interface{} + +func getRoutingTableGetLabelsAttributeTypeOk(arg RoutingTableGetLabelsAttributeType) (ret RoutingTableGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetLabelsAttributeType(arg *RoutingTableGetLabelsAttributeType, val RoutingTableGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type RoutingTableGetNameAttributeType = *string + +func getRoutingTableGetNameAttributeTypeOk(arg RoutingTableGetNameAttributeType) (ret RoutingTableGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetNameAttributeType(arg *RoutingTableGetNameAttributeType, val RoutingTableGetNameRetType) { + *arg = &val +} + +type RoutingTableGetNameArgType = string +type RoutingTableGetNameRetType = string + +/* + types and functions for systemRoutes +*/ + +// isBoolean +type RoutingTablegetSystemRoutesAttributeType = *bool +type RoutingTablegetSystemRoutesArgType = bool +type RoutingTablegetSystemRoutesRetType = bool + +func getRoutingTablegetSystemRoutesAttributeTypeOk(arg RoutingTablegetSystemRoutesAttributeType) (ret RoutingTablegetSystemRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTablegetSystemRoutesAttributeType(arg *RoutingTablegetSystemRoutesAttributeType, val RoutingTablegetSystemRoutesRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type RoutingTableGetUpdatedAtAttributeType = *time.Time +type RoutingTableGetUpdatedAtArgType = time.Time +type RoutingTableGetUpdatedAtRetType = time.Time + +func getRoutingTableGetUpdatedAtAttributeTypeOk(arg RoutingTableGetUpdatedAtAttributeType) (ret RoutingTableGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableGetUpdatedAtAttributeType(arg *RoutingTableGetUpdatedAtAttributeType, val RoutingTableGetUpdatedAtRetType) { + *arg = &val +} + +// RoutingTable An object representing a routing table. +type RoutingTable struct { + // Date-time when resource was created. + CreatedAt RoutingTableGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // This is the default routing table. It can't be deleted and is used if the user does not specify it otherwise. + Default RoutingTablegetDefaultAttributeType `json:"default,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description RoutingTableGetDescriptionAttributeType `json:"description,omitempty"` + // A config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes RoutingTablegetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Universally Unique Identifier (UUID). + Id RoutingTableGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels RoutingTableGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name RoutingTableGetNameAttributeType `json:"name" required:"true"` + SystemRoutes RoutingTablegetSystemRoutesAttributeType `json:"systemRoutes,omitempty"` + // Date-time when resource was last updated. + UpdatedAt RoutingTableGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _RoutingTable RoutingTable + +// NewRoutingTable instantiates a new RoutingTable object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRoutingTable(name RoutingTableGetNameArgType) *RoutingTable { + this := RoutingTable{} + setRoutingTableGetNameAttributeType(&this.Name, name) + return &this +} + +// NewRoutingTableWithDefaults instantiates a new RoutingTable object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRoutingTableWithDefaults() *RoutingTable { + this := RoutingTable{} + var dynamicRoutes bool = true + this.DynamicRoutes = &dynamicRoutes + var systemRoutes bool = true + this.SystemRoutes = &systemRoutes + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *RoutingTable) GetCreatedAt() (res RoutingTableGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetCreatedAtOk() (ret RoutingTableGetCreatedAtRetType, ok bool) { + return getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *RoutingTable) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *RoutingTable) SetCreatedAt(v RoutingTableGetCreatedAtRetType) { + setRoutingTableGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *RoutingTable) GetDefault() (res RoutingTablegetDefaultRetType) { + res, _ = o.GetDefaultOk() + return +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDefaultOk() (ret RoutingTablegetDefaultRetType, ok bool) { + return getRoutingTablegetDefaultAttributeTypeOk(o.Default) +} + +// HasDefault returns a boolean if a field has been set. +func (o *RoutingTable) HasDefault() bool { + _, ok := o.GetDefaultOk() + return ok +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *RoutingTable) SetDefault(v RoutingTablegetDefaultRetType) { + setRoutingTablegetDefaultAttributeType(&o.Default, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *RoutingTable) GetDescription() (res RoutingTableGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDescriptionOk() (ret RoutingTableGetDescriptionRetType, ok bool) { + return getRoutingTableGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *RoutingTable) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *RoutingTable) SetDescription(v RoutingTableGetDescriptionRetType) { + setRoutingTableGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *RoutingTable) GetDynamicRoutes() (res RoutingTablegetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetDynamicRoutesOk() (ret RoutingTablegetDynamicRoutesRetType, ok bool) { + return getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *RoutingTable) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *RoutingTable) SetDynamicRoutes(v RoutingTablegetDynamicRoutesRetType) { + setRoutingTablegetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RoutingTable) GetId() (res RoutingTableGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetIdOk() (ret RoutingTableGetIdRetType, ok bool) { + return getRoutingTableGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *RoutingTable) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RoutingTable) SetId(v RoutingTableGetIdRetType) { + setRoutingTableGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *RoutingTable) GetLabels() (res RoutingTableGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetLabelsOk() (ret RoutingTableGetLabelsRetType, ok bool) { + return getRoutingTableGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *RoutingTable) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *RoutingTable) SetLabels(v RoutingTableGetLabelsRetType) { + setRoutingTableGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *RoutingTable) GetName() (ret RoutingTableGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetNameOk() (ret RoutingTableGetNameRetType, ok bool) { + return getRoutingTableGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *RoutingTable) SetName(v RoutingTableGetNameRetType) { + setRoutingTableGetNameAttributeType(&o.Name, v) +} + +// GetSystemRoutes returns the SystemRoutes field value if set, zero value otherwise. +func (o *RoutingTable) GetSystemRoutes() (res RoutingTablegetSystemRoutesRetType) { + res, _ = o.GetSystemRoutesOk() + return +} + +// GetSystemRoutesOk returns a tuple with the SystemRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetSystemRoutesOk() (ret RoutingTablegetSystemRoutesRetType, ok bool) { + return getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes) +} + +// HasSystemRoutes returns a boolean if a field has been set. +func (o *RoutingTable) HasSystemRoutes() bool { + _, ok := o.GetSystemRoutesOk() + return ok +} + +// SetSystemRoutes gets a reference to the given bool and assigns it to the SystemRoutes field. +func (o *RoutingTable) SetSystemRoutes(v RoutingTablegetSystemRoutesRetType) { + setRoutingTablegetSystemRoutesAttributeType(&o.SystemRoutes, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *RoutingTable) GetUpdatedAt() (res RoutingTableGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoutingTable) GetUpdatedAtOk() (ret RoutingTableGetUpdatedAtRetType, ok bool) { + return getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *RoutingTable) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *RoutingTable) SetUpdatedAt(v RoutingTableGetUpdatedAtRetType) { + setRoutingTableGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o RoutingTable) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRoutingTableGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getRoutingTablegetDefaultAttributeTypeOk(o.Default); ok { + toSerialize["Default"] = val + } + if val, ok := getRoutingTableGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getRoutingTablegetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getRoutingTableGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getRoutingTableGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getRoutingTableGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getRoutingTablegetSystemRoutesAttributeTypeOk(o.SystemRoutes); ok { + toSerialize["SystemRoutes"] = val + } + if val, ok := getRoutingTableGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableRoutingTable struct { + value *RoutingTable + isSet bool +} + +func (v NullableRoutingTable) Get() *RoutingTable { + return v.value +} + +func (v *NullableRoutingTable) Set(val *RoutingTable) { + v.value = val + v.isSet = true +} + +func (v NullableRoutingTable) IsSet() bool { + return v.isSet +} + +func (v *NullableRoutingTable) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoutingTable(val *RoutingTable) *NullableRoutingTable { + return &NullableRoutingTable{value: val, isSet: true} +} + +func (v NullableRoutingTable) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoutingTable) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_routing_table_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_routing_table_list_response.go new file mode 100644 index 00000000..802c8b8c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_routing_table_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the RoutingTableListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RoutingTableListResponse{} + +/* + types and functions for items +*/ + +// isArray +type RoutingTableListResponseGetItemsAttributeType = *[]RoutingTable +type RoutingTableListResponseGetItemsArgType = []RoutingTable +type RoutingTableListResponseGetItemsRetType = []RoutingTable + +func getRoutingTableListResponseGetItemsAttributeTypeOk(arg RoutingTableListResponseGetItemsAttributeType) (ret RoutingTableListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setRoutingTableListResponseGetItemsAttributeType(arg *RoutingTableListResponseGetItemsAttributeType, val RoutingTableListResponseGetItemsRetType) { + *arg = &val +} + +// RoutingTableListResponse Routing table response. +type RoutingTableListResponse struct { + // A list of routing tables. + // REQUIRED + Items RoutingTableListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _RoutingTableListResponse RoutingTableListResponse + +// NewRoutingTableListResponse instantiates a new RoutingTableListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewRoutingTableListResponse(items RoutingTableListResponseGetItemsArgType) *RoutingTableListResponse { + this := RoutingTableListResponse{} + setRoutingTableListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewRoutingTableListResponseWithDefaults instantiates a new RoutingTableListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewRoutingTableListResponseWithDefaults() *RoutingTableListResponse { + this := RoutingTableListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *RoutingTableListResponse) GetItems() (ret RoutingTableListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RoutingTableListResponse) GetItemsOk() (ret RoutingTableListResponseGetItemsRetType, ok bool) { + return getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *RoutingTableListResponse) SetItems(v RoutingTableListResponseGetItemsRetType) { + setRoutingTableListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o RoutingTableListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getRoutingTableListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableRoutingTableListResponse struct { + value *RoutingTableListResponse + isSet bool +} + +func (v NullableRoutingTableListResponse) Get() *RoutingTableListResponse { + return v.value +} + +func (v *NullableRoutingTableListResponse) Set(val *RoutingTableListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRoutingTableListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRoutingTableListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRoutingTableListResponse(val *RoutingTableListResponse) *NullableRoutingTableListResponse { + return &NullableRoutingTableListResponse{value: val, isSet: true} +} + +func (v NullableRoutingTableListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRoutingTableListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group.go new file mode 100644 index 00000000..62fe69b8 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group.go @@ -0,0 +1,468 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the SecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroup{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type SecurityGroupGetCreatedAtAttributeType = *time.Time +type SecurityGroupGetCreatedAtArgType = time.Time +type SecurityGroupGetCreatedAtRetType = time.Time + +func getSecurityGroupGetCreatedAtAttributeTypeOk(arg SecurityGroupGetCreatedAtAttributeType) (ret SecurityGroupGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetCreatedAtAttributeType(arg *SecurityGroupGetCreatedAtAttributeType, val SecurityGroupGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type SecurityGroupGetDescriptionAttributeType = *string + +func getSecurityGroupGetDescriptionAttributeTypeOk(arg SecurityGroupGetDescriptionAttributeType) (ret SecurityGroupGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetDescriptionAttributeType(arg *SecurityGroupGetDescriptionAttributeType, val SecurityGroupGetDescriptionRetType) { + *arg = &val +} + +type SecurityGroupGetDescriptionArgType = string +type SecurityGroupGetDescriptionRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type SecurityGroupGetIdAttributeType = *string + +func getSecurityGroupGetIdAttributeTypeOk(arg SecurityGroupGetIdAttributeType) (ret SecurityGroupGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetIdAttributeType(arg *SecurityGroupGetIdAttributeType, val SecurityGroupGetIdRetType) { + *arg = &val +} + +type SecurityGroupGetIdArgType = string +type SecurityGroupGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type SecurityGroupGetLabelsAttributeType = *map[string]interface{} +type SecurityGroupGetLabelsArgType = map[string]interface{} +type SecurityGroupGetLabelsRetType = map[string]interface{} + +func getSecurityGroupGetLabelsAttributeTypeOk(arg SecurityGroupGetLabelsAttributeType) (ret SecurityGroupGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetLabelsAttributeType(arg *SecurityGroupGetLabelsAttributeType, val SecurityGroupGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type SecurityGroupGetNameAttributeType = *string + +func getSecurityGroupGetNameAttributeTypeOk(arg SecurityGroupGetNameAttributeType) (ret SecurityGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetNameAttributeType(arg *SecurityGroupGetNameAttributeType, val SecurityGroupGetNameRetType) { + *arg = &val +} + +type SecurityGroupGetNameArgType = string +type SecurityGroupGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type SecurityGroupGetRulesAttributeType = *[]SecurityGroupRule +type SecurityGroupGetRulesArgType = []SecurityGroupRule +type SecurityGroupGetRulesRetType = []SecurityGroupRule + +func getSecurityGroupGetRulesAttributeTypeOk(arg SecurityGroupGetRulesAttributeType) (ret SecurityGroupGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetRulesAttributeType(arg *SecurityGroupGetRulesAttributeType, val SecurityGroupGetRulesRetType) { + *arg = &val +} + +/* + types and functions for stateful +*/ + +// isBoolean +type SecurityGroupgetStatefulAttributeType = *bool +type SecurityGroupgetStatefulArgType = bool +type SecurityGroupgetStatefulRetType = bool + +func getSecurityGroupgetStatefulAttributeTypeOk(arg SecurityGroupgetStatefulAttributeType) (ret SecurityGroupgetStatefulRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupgetStatefulAttributeType(arg *SecurityGroupgetStatefulAttributeType, val SecurityGroupgetStatefulRetType) { + *arg = &val +} + +/* + types and functions for updatedAt +*/ + +// isDateTime +type SecurityGroupGetUpdatedAtAttributeType = *time.Time +type SecurityGroupGetUpdatedAtArgType = time.Time +type SecurityGroupGetUpdatedAtRetType = time.Time + +func getSecurityGroupGetUpdatedAtAttributeTypeOk(arg SecurityGroupGetUpdatedAtAttributeType) (ret SecurityGroupGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupGetUpdatedAtAttributeType(arg *SecurityGroupGetUpdatedAtAttributeType, val SecurityGroupGetUpdatedAtRetType) { + *arg = &val +} + +// SecurityGroup Object that represents a security group. +type SecurityGroup struct { + // Date-time when resource was created. + CreatedAt SecurityGroupGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description SecurityGroupGetDescriptionAttributeType `json:"description,omitempty"` + // Universally Unique Identifier (UUID). + Id SecurityGroupGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels SecurityGroupGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name SecurityGroupGetNameAttributeType `json:"name" required:"true"` + // A list containing security group rule objects. + Rules SecurityGroupGetRulesAttributeType `json:"rules,omitempty"` + // Shows if a security group is stateful or stateless. You can only have one type of security groups per network interface/server. + Stateful SecurityGroupgetStatefulAttributeType `json:"stateful,omitempty"` + // Date-time when resource was last updated. + UpdatedAt SecurityGroupGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _SecurityGroup SecurityGroup + +// NewSecurityGroup instantiates a new SecurityGroup object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSecurityGroup(name SecurityGroupGetNameArgType) *SecurityGroup { + this := SecurityGroup{} + setSecurityGroupGetNameAttributeType(&this.Name, name) + return &this +} + +// NewSecurityGroupWithDefaults instantiates a new SecurityGroup object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSecurityGroupWithDefaults() *SecurityGroup { + this := SecurityGroup{} + var stateful bool = true + this.Stateful = &stateful + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SecurityGroup) GetCreatedAt() (res SecurityGroupGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetCreatedAtOk() (ret SecurityGroupGetCreatedAtRetType, ok bool) { + return getSecurityGroupGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SecurityGroup) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SecurityGroup) SetCreatedAt(v SecurityGroupGetCreatedAtRetType) { + setSecurityGroupGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecurityGroup) GetDescription() (res SecurityGroupGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetDescriptionOk() (ret SecurityGroupGetDescriptionRetType, ok bool) { + return getSecurityGroupGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *SecurityGroup) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SecurityGroup) SetDescription(v SecurityGroupGetDescriptionRetType) { + setSecurityGroupGetDescriptionAttributeType(&o.Description, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroup) GetId() (res SecurityGroupGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetIdOk() (ret SecurityGroupGetIdRetType, ok bool) { + return getSecurityGroupGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityGroup) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroup) SetId(v SecurityGroupGetIdRetType) { + setSecurityGroupGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *SecurityGroup) GetLabels() (res SecurityGroupGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetLabelsOk() (ret SecurityGroupGetLabelsRetType, ok bool) { + return getSecurityGroupGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *SecurityGroup) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *SecurityGroup) SetLabels(v SecurityGroupGetLabelsRetType) { + setSecurityGroupGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *SecurityGroup) GetName() (ret SecurityGroupGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetNameOk() (ret SecurityGroupGetNameRetType, ok bool) { + return getSecurityGroupGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *SecurityGroup) SetName(v SecurityGroupGetNameRetType) { + setSecurityGroupGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *SecurityGroup) GetRules() (res SecurityGroupGetRulesRetType) { + res, _ = o.GetRulesOk() + return +} + +// GetRulesOk returns a tuple with the Rules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetRulesOk() (ret SecurityGroupGetRulesRetType, ok bool) { + return getSecurityGroupGetRulesAttributeTypeOk(o.Rules) +} + +// HasRules returns a boolean if a field has been set. +func (o *SecurityGroup) HasRules() bool { + _, ok := o.GetRulesOk() + return ok +} + +// SetRules gets a reference to the given []SecurityGroupRule and assigns it to the Rules field. +func (o *SecurityGroup) SetRules(v SecurityGroupGetRulesRetType) { + setSecurityGroupGetRulesAttributeType(&o.Rules, v) +} + +// GetStateful returns the Stateful field value if set, zero value otherwise. +func (o *SecurityGroup) GetStateful() (res SecurityGroupgetStatefulRetType) { + res, _ = o.GetStatefulOk() + return +} + +// GetStatefulOk returns a tuple with the Stateful field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetStatefulOk() (ret SecurityGroupgetStatefulRetType, ok bool) { + return getSecurityGroupgetStatefulAttributeTypeOk(o.Stateful) +} + +// HasStateful returns a boolean if a field has been set. +func (o *SecurityGroup) HasStateful() bool { + _, ok := o.GetStatefulOk() + return ok +} + +// SetStateful gets a reference to the given bool and assigns it to the Stateful field. +func (o *SecurityGroup) SetStateful(v SecurityGroupgetStatefulRetType) { + setSecurityGroupgetStatefulAttributeType(&o.Stateful, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *SecurityGroup) GetUpdatedAt() (res SecurityGroupGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroup) GetUpdatedAtOk() (ret SecurityGroupGetUpdatedAtRetType, ok bool) { + return getSecurityGroupGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *SecurityGroup) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *SecurityGroup) SetUpdatedAt(v SecurityGroupGetUpdatedAtRetType) { + setSecurityGroupGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o SecurityGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getSecurityGroupGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getSecurityGroupGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSecurityGroupGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getSecurityGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getSecurityGroupGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + if val, ok := getSecurityGroupgetStatefulAttributeTypeOk(o.Stateful); ok { + toSerialize["Stateful"] = val + } + if val, ok := getSecurityGroupGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroup struct { + value *SecurityGroup + isSet bool +} + +func (v NullableSecurityGroup) Get() *SecurityGroup { + return v.value +} + +func (v *NullableSecurityGroup) Set(val *SecurityGroup) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroup(val *SecurityGroup) *NullableSecurityGroup { + return &NullableSecurityGroup{value: val, isSet: true} +} + +func (v NullableSecurityGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_list_response.go new file mode 100644 index 00000000..b7875d57 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SecurityGroupListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupListResponse{} + +/* + types and functions for items +*/ + +// isArray +type SecurityGroupListResponseGetItemsAttributeType = *[]SecurityGroup +type SecurityGroupListResponseGetItemsArgType = []SecurityGroup +type SecurityGroupListResponseGetItemsRetType = []SecurityGroup + +func getSecurityGroupListResponseGetItemsAttributeTypeOk(arg SecurityGroupListResponseGetItemsAttributeType) (ret SecurityGroupListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupListResponseGetItemsAttributeType(arg *SecurityGroupListResponseGetItemsAttributeType, val SecurityGroupListResponseGetItemsRetType) { + *arg = &val +} + +// SecurityGroupListResponse Security group list response. +type SecurityGroupListResponse struct { + // A list containing security group objects. + // REQUIRED + Items SecurityGroupListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _SecurityGroupListResponse SecurityGroupListResponse + +// NewSecurityGroupListResponse instantiates a new SecurityGroupListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSecurityGroupListResponse(items SecurityGroupListResponseGetItemsArgType) *SecurityGroupListResponse { + this := SecurityGroupListResponse{} + setSecurityGroupListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewSecurityGroupListResponseWithDefaults instantiates a new SecurityGroupListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSecurityGroupListResponseWithDefaults() *SecurityGroupListResponse { + this := SecurityGroupListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SecurityGroupListResponse) GetItems() (ret SecurityGroupListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *SecurityGroupListResponse) GetItemsOk() (ret SecurityGroupListResponseGetItemsRetType, ok bool) { + return getSecurityGroupListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *SecurityGroupListResponse) SetItems(v SecurityGroupListResponseGetItemsRetType) { + setSecurityGroupListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o SecurityGroupListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupListResponse struct { + value *SecurityGroupListResponse + isSet bool +} + +func (v NullableSecurityGroupListResponse) Get() *SecurityGroupListResponse { + return v.value +} + +func (v *NullableSecurityGroupListResponse) Set(val *SecurityGroupListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupListResponse(val *SecurityGroupListResponse) *NullableSecurityGroupListResponse { + return &NullableSecurityGroupListResponse{value: val, isSet: true} +} + +func (v NullableSecurityGroupListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule.go new file mode 100644 index 00000000..ac143ec4 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule.go @@ -0,0 +1,661 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the SecurityGroupRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRule{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type SecurityGroupRuleGetCreatedAtAttributeType = *time.Time +type SecurityGroupRuleGetCreatedAtArgType = time.Time +type SecurityGroupRuleGetCreatedAtRetType = time.Time + +func getSecurityGroupRuleGetCreatedAtAttributeTypeOk(arg SecurityGroupRuleGetCreatedAtAttributeType) (ret SecurityGroupRuleGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetCreatedAtAttributeType(arg *SecurityGroupRuleGetCreatedAtAttributeType, val SecurityGroupRuleGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type SecurityGroupRuleGetDescriptionAttributeType = *string + +func getSecurityGroupRuleGetDescriptionAttributeTypeOk(arg SecurityGroupRuleGetDescriptionAttributeType) (ret SecurityGroupRuleGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetDescriptionAttributeType(arg *SecurityGroupRuleGetDescriptionAttributeType, val SecurityGroupRuleGetDescriptionRetType) { + *arg = &val +} + +type SecurityGroupRuleGetDescriptionArgType = string +type SecurityGroupRuleGetDescriptionRetType = string + +/* + types and functions for direction +*/ + +// isNotNullableString +type SecurityGroupRuleGetDirectionAttributeType = *string + +func getSecurityGroupRuleGetDirectionAttributeTypeOk(arg SecurityGroupRuleGetDirectionAttributeType) (ret SecurityGroupRuleGetDirectionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetDirectionAttributeType(arg *SecurityGroupRuleGetDirectionAttributeType, val SecurityGroupRuleGetDirectionRetType) { + *arg = &val +} + +type SecurityGroupRuleGetDirectionArgType = string +type SecurityGroupRuleGetDirectionRetType = string + +/* + types and functions for ethertype +*/ + +// isNotNullableString +type SecurityGroupRuleGetEthertypeAttributeType = *string + +func getSecurityGroupRuleGetEthertypeAttributeTypeOk(arg SecurityGroupRuleGetEthertypeAttributeType) (ret SecurityGroupRuleGetEthertypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetEthertypeAttributeType(arg *SecurityGroupRuleGetEthertypeAttributeType, val SecurityGroupRuleGetEthertypeRetType) { + *arg = &val +} + +type SecurityGroupRuleGetEthertypeArgType = string +type SecurityGroupRuleGetEthertypeRetType = string + +/* + types and functions for icmpParameters +*/ + +// isModel +type SecurityGroupRuleGetIcmpParametersAttributeType = *ICMPParameters +type SecurityGroupRuleGetIcmpParametersArgType = ICMPParameters +type SecurityGroupRuleGetIcmpParametersRetType = ICMPParameters + +func getSecurityGroupRuleGetIcmpParametersAttributeTypeOk(arg SecurityGroupRuleGetIcmpParametersAttributeType) (ret SecurityGroupRuleGetIcmpParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetIcmpParametersAttributeType(arg *SecurityGroupRuleGetIcmpParametersAttributeType, val SecurityGroupRuleGetIcmpParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type SecurityGroupRuleGetIdAttributeType = *string + +func getSecurityGroupRuleGetIdAttributeTypeOk(arg SecurityGroupRuleGetIdAttributeType) (ret SecurityGroupRuleGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetIdAttributeType(arg *SecurityGroupRuleGetIdAttributeType, val SecurityGroupRuleGetIdRetType) { + *arg = &val +} + +type SecurityGroupRuleGetIdArgType = string +type SecurityGroupRuleGetIdRetType = string + +/* + types and functions for ipRange +*/ + +// isNotNullableString +type SecurityGroupRuleGetIpRangeAttributeType = *string + +func getSecurityGroupRuleGetIpRangeAttributeTypeOk(arg SecurityGroupRuleGetIpRangeAttributeType) (ret SecurityGroupRuleGetIpRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetIpRangeAttributeType(arg *SecurityGroupRuleGetIpRangeAttributeType, val SecurityGroupRuleGetIpRangeRetType) { + *arg = &val +} + +type SecurityGroupRuleGetIpRangeArgType = string +type SecurityGroupRuleGetIpRangeRetType = string + +/* + types and functions for portRange +*/ + +// isModel +type SecurityGroupRuleGetPortRangeAttributeType = *PortRange +type SecurityGroupRuleGetPortRangeArgType = PortRange +type SecurityGroupRuleGetPortRangeRetType = PortRange + +func getSecurityGroupRuleGetPortRangeAttributeTypeOk(arg SecurityGroupRuleGetPortRangeAttributeType) (ret SecurityGroupRuleGetPortRangeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetPortRangeAttributeType(arg *SecurityGroupRuleGetPortRangeAttributeType, val SecurityGroupRuleGetPortRangeRetType) { + *arg = &val +} + +/* + types and functions for remoteSecurityGroupId +*/ + +// isNotNullableString +type SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType = *string + +func getSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(arg SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType) (ret SecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(arg *SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType, val SecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + *arg = &val +} + +type SecurityGroupRuleGetRemoteSecurityGroupIdArgType = string +type SecurityGroupRuleGetRemoteSecurityGroupIdRetType = string + +/* + types and functions for securityGroupId +*/ + +// isNotNullableString +type SecurityGroupRuleGetSecurityGroupIdAttributeType = *string + +func getSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(arg SecurityGroupRuleGetSecurityGroupIdAttributeType) (ret SecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetSecurityGroupIdAttributeType(arg *SecurityGroupRuleGetSecurityGroupIdAttributeType, val SecurityGroupRuleGetSecurityGroupIdRetType) { + *arg = &val +} + +type SecurityGroupRuleGetSecurityGroupIdArgType = string +type SecurityGroupRuleGetSecurityGroupIdRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type SecurityGroupRuleGetUpdatedAtAttributeType = *time.Time +type SecurityGroupRuleGetUpdatedAtArgType = time.Time +type SecurityGroupRuleGetUpdatedAtRetType = time.Time + +func getSecurityGroupRuleGetUpdatedAtAttributeTypeOk(arg SecurityGroupRuleGetUpdatedAtAttributeType) (ret SecurityGroupRuleGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetUpdatedAtAttributeType(arg *SecurityGroupRuleGetUpdatedAtAttributeType, val SecurityGroupRuleGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for protocol +*/ + +// isModel +type SecurityGroupRuleGetProtocolAttributeType = *Protocol +type SecurityGroupRuleGetProtocolArgType = Protocol +type SecurityGroupRuleGetProtocolRetType = Protocol + +func getSecurityGroupRuleGetProtocolAttributeTypeOk(arg SecurityGroupRuleGetProtocolAttributeType) (ret SecurityGroupRuleGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleGetProtocolAttributeType(arg *SecurityGroupRuleGetProtocolAttributeType, val SecurityGroupRuleGetProtocolRetType) { + *arg = &val +} + +// SecurityGroupRule Object that represents a security group rule. +type SecurityGroupRule struct { + // Date-time when resource was created. + CreatedAt SecurityGroupRuleGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description SecurityGroupRuleGetDescriptionAttributeType `json:"description,omitempty"` + // The direction of the traffic which the rule should match. Possible values: `ingress`, `egress`. + // REQUIRED + Direction SecurityGroupRuleGetDirectionAttributeType `json:"direction" required:"true"` + // The ethertype which the rule should match. Possible values: `IPv4`, `IPv6`. + Ethertype SecurityGroupRuleGetEthertypeAttributeType `json:"ethertype,omitempty"` + IcmpParameters SecurityGroupRuleGetIcmpParametersAttributeType `json:"icmpParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id SecurityGroupRuleGetIdAttributeType `json:"id,omitempty"` + // Classless Inter-Domain Routing (CIDR). + IpRange SecurityGroupRuleGetIpRangeAttributeType `json:"ipRange,omitempty"` + PortRange SecurityGroupRuleGetPortRangeAttributeType `json:"portRange,omitempty"` + // Universally Unique Identifier (UUID). + RemoteSecurityGroupId SecurityGroupRuleGetRemoteSecurityGroupIdAttributeType `json:"remoteSecurityGroupId,omitempty"` + // Universally Unique Identifier (UUID). + SecurityGroupId SecurityGroupRuleGetSecurityGroupIdAttributeType `json:"securityGroupId,omitempty"` + // Date-time when resource was last updated. + UpdatedAt SecurityGroupRuleGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + Protocol SecurityGroupRuleGetProtocolAttributeType `json:"protocol,omitempty"` +} + +type _SecurityGroupRule SecurityGroupRule + +// NewSecurityGroupRule instantiates a new SecurityGroupRule object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSecurityGroupRule(direction SecurityGroupRuleGetDirectionArgType) *SecurityGroupRule { + this := SecurityGroupRule{} + setSecurityGroupRuleGetDirectionAttributeType(&this.Direction, direction) + return &this +} + +// NewSecurityGroupRuleWithDefaults instantiates a new SecurityGroupRule object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSecurityGroupRuleWithDefaults() *SecurityGroupRule { + this := SecurityGroupRule{} + var ethertype string = "IPv4" + this.Ethertype = ðertype + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetCreatedAt() (res SecurityGroupRuleGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetCreatedAtOk() (ret SecurityGroupRuleGetCreatedAtRetType, ok bool) { + return getSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *SecurityGroupRule) SetCreatedAt(v SecurityGroupRuleGetCreatedAtRetType) { + setSecurityGroupRuleGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetDescription() (res SecurityGroupRuleGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetDescriptionOk() (ret SecurityGroupRuleGetDescriptionRetType, ok bool) { + return getSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SecurityGroupRule) SetDescription(v SecurityGroupRuleGetDescriptionRetType) { + setSecurityGroupRuleGetDescriptionAttributeType(&o.Description, v) +} + +// GetDirection returns the Direction field value +func (o *SecurityGroupRule) GetDirection() (ret SecurityGroupRuleGetDirectionRetType) { + ret, _ = o.GetDirectionOk() + return ret +} + +// GetDirectionOk returns a tuple with the Direction field value +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetDirectionOk() (ret SecurityGroupRuleGetDirectionRetType, ok bool) { + return getSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction) +} + +// SetDirection sets field value +func (o *SecurityGroupRule) SetDirection(v SecurityGroupRuleGetDirectionRetType) { + setSecurityGroupRuleGetDirectionAttributeType(&o.Direction, v) +} + +// GetEthertype returns the Ethertype field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetEthertype() (res SecurityGroupRuleGetEthertypeRetType) { + res, _ = o.GetEthertypeOk() + return +} + +// GetEthertypeOk returns a tuple with the Ethertype field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetEthertypeOk() (ret SecurityGroupRuleGetEthertypeRetType, ok bool) { + return getSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype) +} + +// HasEthertype returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasEthertype() bool { + _, ok := o.GetEthertypeOk() + return ok +} + +// SetEthertype gets a reference to the given string and assigns it to the Ethertype field. +func (o *SecurityGroupRule) SetEthertype(v SecurityGroupRuleGetEthertypeRetType) { + setSecurityGroupRuleGetEthertypeAttributeType(&o.Ethertype, v) +} + +// GetIcmpParameters returns the IcmpParameters field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetIcmpParameters() (res SecurityGroupRuleGetIcmpParametersRetType) { + res, _ = o.GetIcmpParametersOk() + return +} + +// GetIcmpParametersOk returns a tuple with the IcmpParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIcmpParametersOk() (ret SecurityGroupRuleGetIcmpParametersRetType, ok bool) { + return getSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters) +} + +// HasIcmpParameters returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasIcmpParameters() bool { + _, ok := o.GetIcmpParametersOk() + return ok +} + +// SetIcmpParameters gets a reference to the given ICMPParameters and assigns it to the IcmpParameters field. +func (o *SecurityGroupRule) SetIcmpParameters(v SecurityGroupRuleGetIcmpParametersRetType) { + setSecurityGroupRuleGetIcmpParametersAttributeType(&o.IcmpParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetId() (res SecurityGroupRuleGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIdOk() (ret SecurityGroupRuleGetIdRetType, ok bool) { + return getSecurityGroupRuleGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroupRule) SetId(v SecurityGroupRuleGetIdRetType) { + setSecurityGroupRuleGetIdAttributeType(&o.Id, v) +} + +// GetIpRange returns the IpRange field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetIpRange() (res SecurityGroupRuleGetIpRangeRetType) { + res, _ = o.GetIpRangeOk() + return +} + +// GetIpRangeOk returns a tuple with the IpRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetIpRangeOk() (ret SecurityGroupRuleGetIpRangeRetType, ok bool) { + return getSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange) +} + +// HasIpRange returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasIpRange() bool { + _, ok := o.GetIpRangeOk() + return ok +} + +// SetIpRange gets a reference to the given string and assigns it to the IpRange field. +func (o *SecurityGroupRule) SetIpRange(v SecurityGroupRuleGetIpRangeRetType) { + setSecurityGroupRuleGetIpRangeAttributeType(&o.IpRange, v) +} + +// GetPortRange returns the PortRange field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetPortRange() (res SecurityGroupRuleGetPortRangeRetType) { + res, _ = o.GetPortRangeOk() + return +} + +// GetPortRangeOk returns a tuple with the PortRange field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetPortRangeOk() (ret SecurityGroupRuleGetPortRangeRetType, ok bool) { + return getSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange) +} + +// HasPortRange returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasPortRange() bool { + _, ok := o.GetPortRangeOk() + return ok +} + +// SetPortRange gets a reference to the given PortRange and assigns it to the PortRange field. +func (o *SecurityGroupRule) SetPortRange(v SecurityGroupRuleGetPortRangeRetType) { + setSecurityGroupRuleGetPortRangeAttributeType(&o.PortRange, v) +} + +// GetRemoteSecurityGroupId returns the RemoteSecurityGroupId field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetRemoteSecurityGroupId() (res SecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + res, _ = o.GetRemoteSecurityGroupIdOk() + return +} + +// GetRemoteSecurityGroupIdOk returns a tuple with the RemoteSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetRemoteSecurityGroupIdOk() (ret SecurityGroupRuleGetRemoteSecurityGroupIdRetType, ok bool) { + return getSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId) +} + +// HasRemoteSecurityGroupId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasRemoteSecurityGroupId() bool { + _, ok := o.GetRemoteSecurityGroupIdOk() + return ok +} + +// SetRemoteSecurityGroupId gets a reference to the given string and assigns it to the RemoteSecurityGroupId field. +func (o *SecurityGroupRule) SetRemoteSecurityGroupId(v SecurityGroupRuleGetRemoteSecurityGroupIdRetType) { + setSecurityGroupRuleGetRemoteSecurityGroupIdAttributeType(&o.RemoteSecurityGroupId, v) +} + +// GetSecurityGroupId returns the SecurityGroupId field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetSecurityGroupId() (res SecurityGroupRuleGetSecurityGroupIdRetType) { + res, _ = o.GetSecurityGroupIdOk() + return +} + +// GetSecurityGroupIdOk returns a tuple with the SecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetSecurityGroupIdOk() (ret SecurityGroupRuleGetSecurityGroupIdRetType, ok bool) { + return getSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId) +} + +// HasSecurityGroupId returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasSecurityGroupId() bool { + _, ok := o.GetSecurityGroupIdOk() + return ok +} + +// SetSecurityGroupId gets a reference to the given string and assigns it to the SecurityGroupId field. +func (o *SecurityGroupRule) SetSecurityGroupId(v SecurityGroupRuleGetSecurityGroupIdRetType) { + setSecurityGroupRuleGetSecurityGroupIdAttributeType(&o.SecurityGroupId, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetUpdatedAt() (res SecurityGroupRuleGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetUpdatedAtOk() (ret SecurityGroupRuleGetUpdatedAtRetType, ok bool) { + return getSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *SecurityGroupRule) SetUpdatedAt(v SecurityGroupRuleGetUpdatedAtRetType) { + setSecurityGroupRuleGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *SecurityGroupRule) GetProtocol() (res SecurityGroupRuleGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRule) GetProtocolOk() (ret SecurityGroupRuleGetProtocolRetType, ok bool) { + return getSecurityGroupRuleGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *SecurityGroupRule) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given Protocol and assigns it to the Protocol field. +func (o *SecurityGroupRule) SetProtocol(v SecurityGroupRuleGetProtocolRetType) { + setSecurityGroupRuleGetProtocolAttributeType(&o.Protocol, v) +} + +func (o SecurityGroupRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupRuleGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getSecurityGroupRuleGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getSecurityGroupRuleGetDirectionAttributeTypeOk(o.Direction); ok { + toSerialize["Direction"] = val + } + if val, ok := getSecurityGroupRuleGetEthertypeAttributeTypeOk(o.Ethertype); ok { + toSerialize["Ethertype"] = val + } + if val, ok := getSecurityGroupRuleGetIcmpParametersAttributeTypeOk(o.IcmpParameters); ok { + toSerialize["IcmpParameters"] = val + } + if val, ok := getSecurityGroupRuleGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSecurityGroupRuleGetIpRangeAttributeTypeOk(o.IpRange); ok { + toSerialize["IpRange"] = val + } + if val, ok := getSecurityGroupRuleGetPortRangeAttributeTypeOk(o.PortRange); ok { + toSerialize["PortRange"] = val + } + if val, ok := getSecurityGroupRuleGetRemoteSecurityGroupIdAttributeTypeOk(o.RemoteSecurityGroupId); ok { + toSerialize["RemoteSecurityGroupId"] = val + } + if val, ok := getSecurityGroupRuleGetSecurityGroupIdAttributeTypeOk(o.SecurityGroupId); ok { + toSerialize["SecurityGroupId"] = val + } + if val, ok := getSecurityGroupRuleGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getSecurityGroupRuleGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupRule struct { + value *SecurityGroupRule + isSet bool +} + +func (v NullableSecurityGroupRule) Get() *SecurityGroupRule { + return v.value +} + +func (v *NullableSecurityGroupRule) Set(val *SecurityGroupRule) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRule) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRule(val *SecurityGroupRule) *NullableSecurityGroupRule { + return &NullableSecurityGroupRule{value: val, isSet: true} +} + +func (v NullableSecurityGroupRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule_list_response.go new file mode 100644 index 00000000..b8647242 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SecurityGroupRuleListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRuleListResponse{} + +/* + types and functions for items +*/ + +// isArray +type SecurityGroupRuleListResponseGetItemsAttributeType = *[]SecurityGroupRule +type SecurityGroupRuleListResponseGetItemsArgType = []SecurityGroupRule +type SecurityGroupRuleListResponseGetItemsRetType = []SecurityGroupRule + +func getSecurityGroupRuleListResponseGetItemsAttributeTypeOk(arg SecurityGroupRuleListResponseGetItemsAttributeType) (ret SecurityGroupRuleListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleListResponseGetItemsAttributeType(arg *SecurityGroupRuleListResponseGetItemsAttributeType, val SecurityGroupRuleListResponseGetItemsRetType) { + *arg = &val +} + +// SecurityGroupRuleListResponse Security group rule list response. +type SecurityGroupRuleListResponse struct { + // A list containing security group rule objects. + // REQUIRED + Items SecurityGroupRuleListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _SecurityGroupRuleListResponse SecurityGroupRuleListResponse + +// NewSecurityGroupRuleListResponse instantiates a new SecurityGroupRuleListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSecurityGroupRuleListResponse(items SecurityGroupRuleListResponseGetItemsArgType) *SecurityGroupRuleListResponse { + this := SecurityGroupRuleListResponse{} + setSecurityGroupRuleListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewSecurityGroupRuleListResponseWithDefaults instantiates a new SecurityGroupRuleListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSecurityGroupRuleListResponseWithDefaults() *SecurityGroupRuleListResponse { + this := SecurityGroupRuleListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SecurityGroupRuleListResponse) GetItems() (ret SecurityGroupRuleListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *SecurityGroupRuleListResponse) GetItemsOk() (ret SecurityGroupRuleListResponseGetItemsRetType, ok bool) { + return getSecurityGroupRuleListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *SecurityGroupRuleListResponse) SetItems(v SecurityGroupRuleListResponseGetItemsRetType) { + setSecurityGroupRuleListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o SecurityGroupRuleListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupRuleListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupRuleListResponse struct { + value *SecurityGroupRuleListResponse + isSet bool +} + +func (v NullableSecurityGroupRuleListResponse) Get() *SecurityGroupRuleListResponse { + return v.value +} + +func (v *NullableSecurityGroupRuleListResponse) Set(val *SecurityGroupRuleListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRuleListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRuleListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRuleListResponse(val *SecurityGroupRuleListResponse) *NullableSecurityGroupRuleListResponse { + return &NullableSecurityGroupRuleListResponse{value: val, isSet: true} +} + +func (v NullableSecurityGroupRuleListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRuleListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule_protocol.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule_protocol.go new file mode 100644 index 00000000..f2d88d02 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_security_group_rule_protocol.go @@ -0,0 +1,127 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SecurityGroupRuleProtocol type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRuleProtocol{} + +/* + types and functions for protocol +*/ + +// isModel +type SecurityGroupRuleProtocolGetProtocolAttributeType = *Protocol +type SecurityGroupRuleProtocolGetProtocolArgType = Protocol +type SecurityGroupRuleProtocolGetProtocolRetType = Protocol + +func getSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(arg SecurityGroupRuleProtocolGetProtocolAttributeType) (ret SecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSecurityGroupRuleProtocolGetProtocolAttributeType(arg *SecurityGroupRuleProtocolGetProtocolAttributeType, val SecurityGroupRuleProtocolGetProtocolRetType) { + *arg = &val +} + +// SecurityGroupRuleProtocol The internet protocol which the rule matches. +type SecurityGroupRuleProtocol struct { + Protocol SecurityGroupRuleProtocolGetProtocolAttributeType `json:"protocol,omitempty"` +} + +// NewSecurityGroupRuleProtocol instantiates a new SecurityGroupRuleProtocol object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSecurityGroupRuleProtocol() *SecurityGroupRuleProtocol { + this := SecurityGroupRuleProtocol{} + return &this +} + +// NewSecurityGroupRuleProtocolWithDefaults instantiates a new SecurityGroupRuleProtocol object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSecurityGroupRuleProtocolWithDefaults() *SecurityGroupRuleProtocol { + this := SecurityGroupRuleProtocol{} + return &this +} + +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *SecurityGroupRuleProtocol) GetProtocol() (res SecurityGroupRuleProtocolGetProtocolRetType) { + res, _ = o.GetProtocolOk() + return +} + +// GetProtocolOk returns a tuple with the Protocol field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SecurityGroupRuleProtocol) GetProtocolOk() (ret SecurityGroupRuleProtocolGetProtocolRetType, ok bool) { + return getSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol) +} + +// HasProtocol returns a boolean if a field has been set. +func (o *SecurityGroupRuleProtocol) HasProtocol() bool { + _, ok := o.GetProtocolOk() + return ok +} + +// SetProtocol gets a reference to the given Protocol and assigns it to the Protocol field. +func (o *SecurityGroupRuleProtocol) SetProtocol(v SecurityGroupRuleProtocolGetProtocolRetType) { + setSecurityGroupRuleProtocolGetProtocolAttributeType(&o.Protocol, v) +} + +func (o SecurityGroupRuleProtocol) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSecurityGroupRuleProtocolGetProtocolAttributeTypeOk(o.Protocol); ok { + toSerialize["Protocol"] = val + } + return toSerialize, nil +} + +type NullableSecurityGroupRuleProtocol struct { + value *SecurityGroupRuleProtocol + isSet bool +} + +func (v NullableSecurityGroupRuleProtocol) Get() *SecurityGroupRuleProtocol { + return v.value +} + +func (v *NullableSecurityGroupRuleProtocol) Set(val *SecurityGroupRuleProtocol) { + v.value = val + v.isSet = true +} + +func (v NullableSecurityGroupRuleProtocol) IsSet() bool { + return v.isSet +} + +func (v *NullableSecurityGroupRuleProtocol) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSecurityGroupRuleProtocol(val *SecurityGroupRuleProtocol) *NullableSecurityGroupRuleProtocol { + return &NullableSecurityGroupRuleProtocol{value: val, isSet: true} +} + +func (v NullableSecurityGroupRuleProtocol) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSecurityGroupRuleProtocol) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server.go new file mode 100644 index 00000000..2fe94bf4 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server.go @@ -0,0 +1,1233 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Server type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Server{} + +/* + types and functions for affinityGroup +*/ + +// isNotNullableString +type ServerGetAffinityGroupAttributeType = *string + +func getServerGetAffinityGroupAttributeTypeOk(arg ServerGetAffinityGroupAttributeType) (ret ServerGetAffinityGroupRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetAffinityGroupAttributeType(arg *ServerGetAffinityGroupAttributeType, val ServerGetAffinityGroupRetType) { + *arg = &val +} + +type ServerGetAffinityGroupArgType = string +type ServerGetAffinityGroupRetType = string + +/* + types and functions for agent +*/ + +// isModel +type ServerGetAgentAttributeType = *ServerAgent +type ServerGetAgentArgType = ServerAgent +type ServerGetAgentRetType = ServerAgent + +func getServerGetAgentAttributeTypeOk(arg ServerGetAgentAttributeType) (ret ServerGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetAgentAttributeType(arg *ServerGetAgentAttributeType, val ServerGetAgentRetType) { + *arg = &val +} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type ServerGetAvailabilityZoneAttributeType = *string + +func getServerGetAvailabilityZoneAttributeTypeOk(arg ServerGetAvailabilityZoneAttributeType) (ret ServerGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetAvailabilityZoneAttributeType(arg *ServerGetAvailabilityZoneAttributeType, val ServerGetAvailabilityZoneRetType) { + *arg = &val +} + +type ServerGetAvailabilityZoneArgType = string +type ServerGetAvailabilityZoneRetType = string + +/* + types and functions for bootVolume +*/ + +// isModel +type ServerGetBootVolumeAttributeType = *ServerBootVolume +type ServerGetBootVolumeArgType = ServerBootVolume +type ServerGetBootVolumeRetType = ServerBootVolume + +func getServerGetBootVolumeAttributeTypeOk(arg ServerGetBootVolumeAttributeType) (ret ServerGetBootVolumeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetBootVolumeAttributeType(arg *ServerGetBootVolumeAttributeType, val ServerGetBootVolumeRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type ServerGetCreatedAtAttributeType = *time.Time +type ServerGetCreatedAtArgType = time.Time +type ServerGetCreatedAtRetType = time.Time + +func getServerGetCreatedAtAttributeTypeOk(arg ServerGetCreatedAtAttributeType) (ret ServerGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetCreatedAtAttributeType(arg *ServerGetCreatedAtAttributeType, val ServerGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for errorMessage +*/ + +// isNotNullableString +type ServerGetErrorMessageAttributeType = *string + +func getServerGetErrorMessageAttributeTypeOk(arg ServerGetErrorMessageAttributeType) (ret ServerGetErrorMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetErrorMessageAttributeType(arg *ServerGetErrorMessageAttributeType, val ServerGetErrorMessageRetType) { + *arg = &val +} + +type ServerGetErrorMessageArgType = string +type ServerGetErrorMessageRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type ServerGetIdAttributeType = *string + +func getServerGetIdAttributeTypeOk(arg ServerGetIdAttributeType) (ret ServerGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetIdAttributeType(arg *ServerGetIdAttributeType, val ServerGetIdRetType) { + *arg = &val +} + +type ServerGetIdArgType = string +type ServerGetIdRetType = string + +/* + types and functions for imageId +*/ + +// isNotNullableString +type ServerGetImageIdAttributeType = *string + +func getServerGetImageIdAttributeTypeOk(arg ServerGetImageIdAttributeType) (ret ServerGetImageIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetImageIdAttributeType(arg *ServerGetImageIdAttributeType, val ServerGetImageIdRetType) { + *arg = &val +} + +type ServerGetImageIdArgType = string +type ServerGetImageIdRetType = string + +/* + types and functions for keypairName +*/ + +// isNotNullableString +type ServerGetKeypairNameAttributeType = *string + +func getServerGetKeypairNameAttributeTypeOk(arg ServerGetKeypairNameAttributeType) (ret ServerGetKeypairNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetKeypairNameAttributeType(arg *ServerGetKeypairNameAttributeType, val ServerGetKeypairNameRetType) { + *arg = &val +} + +type ServerGetKeypairNameArgType = string +type ServerGetKeypairNameRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type ServerGetLabelsAttributeType = *map[string]interface{} +type ServerGetLabelsArgType = map[string]interface{} +type ServerGetLabelsRetType = map[string]interface{} + +func getServerGetLabelsAttributeTypeOk(arg ServerGetLabelsAttributeType) (ret ServerGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetLabelsAttributeType(arg *ServerGetLabelsAttributeType, val ServerGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for launchedAt +*/ + +// isDateTime +type ServerGetLaunchedAtAttributeType = *time.Time +type ServerGetLaunchedAtArgType = time.Time +type ServerGetLaunchedAtRetType = time.Time + +func getServerGetLaunchedAtAttributeTypeOk(arg ServerGetLaunchedAtAttributeType) (ret ServerGetLaunchedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetLaunchedAtAttributeType(arg *ServerGetLaunchedAtAttributeType, val ServerGetLaunchedAtRetType) { + *arg = &val +} + +/* + types and functions for machineType +*/ + +// isNotNullableString +type ServerGetMachineTypeAttributeType = *string + +func getServerGetMachineTypeAttributeTypeOk(arg ServerGetMachineTypeAttributeType) (ret ServerGetMachineTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetMachineTypeAttributeType(arg *ServerGetMachineTypeAttributeType, val ServerGetMachineTypeRetType) { + *arg = &val +} + +type ServerGetMachineTypeArgType = string +type ServerGetMachineTypeRetType = string + +/* + types and functions for maintenanceWindow +*/ + +// isModel +type ServerGetMaintenanceWindowAttributeType = *ServerMaintenance +type ServerGetMaintenanceWindowArgType = ServerMaintenance +type ServerGetMaintenanceWindowRetType = ServerMaintenance + +func getServerGetMaintenanceWindowAttributeTypeOk(arg ServerGetMaintenanceWindowAttributeType) (ret ServerGetMaintenanceWindowRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetMaintenanceWindowAttributeType(arg *ServerGetMaintenanceWindowAttributeType, val ServerGetMaintenanceWindowRetType) { + *arg = &val +} + +/* + types and functions for metadata +*/ + +// isFreeform +type ServerGetMetadataAttributeType = *map[string]interface{} +type ServerGetMetadataArgType = map[string]interface{} +type ServerGetMetadataRetType = map[string]interface{} + +func getServerGetMetadataAttributeTypeOk(arg ServerGetMetadataAttributeType) (ret ServerGetMetadataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetMetadataAttributeType(arg *ServerGetMetadataAttributeType, val ServerGetMetadataRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type ServerGetNameAttributeType = *string + +func getServerGetNameAttributeTypeOk(arg ServerGetNameAttributeType) (ret ServerGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetNameAttributeType(arg *ServerGetNameAttributeType, val ServerGetNameRetType) { + *arg = &val +} + +type ServerGetNameArgType = string +type ServerGetNameRetType = string + +/* + types and functions for networking +*/ + +// isModel +type ServerGetNetworkingAttributeType = *ServerNetworking +type ServerGetNetworkingArgType = ServerNetworking +type ServerGetNetworkingRetType = ServerNetworking + +func getServerGetNetworkingAttributeTypeOk(arg ServerGetNetworkingAttributeType) (ret ServerGetNetworkingRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetNetworkingAttributeType(arg *ServerGetNetworkingAttributeType, val ServerGetNetworkingRetType) { + *arg = &val +} + +/* + types and functions for nics +*/ + +// isArray +type ServerGetNicsAttributeType = *[]ServerNetwork +type ServerGetNicsArgType = []ServerNetwork +type ServerGetNicsRetType = []ServerNetwork + +func getServerGetNicsAttributeTypeOk(arg ServerGetNicsAttributeType) (ret ServerGetNicsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetNicsAttributeType(arg *ServerGetNicsAttributeType, val ServerGetNicsRetType) { + *arg = &val +} + +/* + types and functions for powerStatus +*/ + +// isNotNullableString +type ServerGetPowerStatusAttributeType = *string + +func getServerGetPowerStatusAttributeTypeOk(arg ServerGetPowerStatusAttributeType) (ret ServerGetPowerStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetPowerStatusAttributeType(arg *ServerGetPowerStatusAttributeType, val ServerGetPowerStatusRetType) { + *arg = &val +} + +type ServerGetPowerStatusArgType = string +type ServerGetPowerStatusRetType = string + +/* + types and functions for securityGroups +*/ + +// isArray +type ServerGetSecurityGroupsAttributeType = *[]string +type ServerGetSecurityGroupsArgType = []string +type ServerGetSecurityGroupsRetType = []string + +func getServerGetSecurityGroupsAttributeTypeOk(arg ServerGetSecurityGroupsAttributeType) (ret ServerGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetSecurityGroupsAttributeType(arg *ServerGetSecurityGroupsAttributeType, val ServerGetSecurityGroupsRetType) { + *arg = &val +} + +/* + types and functions for serviceAccountMails +*/ + +// isArray +type ServerGetServiceAccountMailsAttributeType = *[]string +type ServerGetServiceAccountMailsArgType = []string +type ServerGetServiceAccountMailsRetType = []string + +func getServerGetServiceAccountMailsAttributeTypeOk(arg ServerGetServiceAccountMailsAttributeType) (ret ServerGetServiceAccountMailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetServiceAccountMailsAttributeType(arg *ServerGetServiceAccountMailsAttributeType, val ServerGetServiceAccountMailsRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ServerGetStatusAttributeType = *string + +func getServerGetStatusAttributeTypeOk(arg ServerGetStatusAttributeType) (ret ServerGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetStatusAttributeType(arg *ServerGetStatusAttributeType, val ServerGetStatusRetType) { + *arg = &val +} + +type ServerGetStatusArgType = string +type ServerGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type ServerGetUpdatedAtAttributeType = *time.Time +type ServerGetUpdatedAtArgType = time.Time +type ServerGetUpdatedAtRetType = time.Time + +func getServerGetUpdatedAtAttributeTypeOk(arg ServerGetUpdatedAtAttributeType) (ret ServerGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetUpdatedAtAttributeType(arg *ServerGetUpdatedAtAttributeType, val ServerGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for userData +*/ + +// isByteArray +type ServerGetUserDataAttributeType = *[]byte +type ServerGetUserDataArgType = []byte +type ServerGetUserDataRetType = []byte + +func getServerGetUserDataAttributeTypeOk(arg ServerGetUserDataAttributeType) (ret ServerGetUserDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetUserDataAttributeType(arg *ServerGetUserDataAttributeType, val ServerGetUserDataRetType) { + *arg = &val +} + +/* + types and functions for volumes +*/ + +// isArray +type ServerGetVolumesAttributeType = *[]string +type ServerGetVolumesArgType = []string +type ServerGetVolumesRetType = []string + +func getServerGetVolumesAttributeTypeOk(arg ServerGetVolumesAttributeType) (ret ServerGetVolumesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerGetVolumesAttributeType(arg *ServerGetVolumesAttributeType, val ServerGetVolumesRetType) { + *arg = &val +} + +// Server Representation of a single server object. +type Server struct { + // Universally Unique Identifier (UUID). + AffinityGroup ServerGetAffinityGroupAttributeType `json:"affinityGroup,omitempty"` + Agent ServerGetAgentAttributeType `json:"agent,omitempty"` + // Object that represents an availability zone. + AvailabilityZone ServerGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + BootVolume ServerGetBootVolumeAttributeType `json:"bootVolume,omitempty"` + // Date-time when resource was created. + CreatedAt ServerGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // An error message. + ErrorMessage ServerGetErrorMessageAttributeType `json:"errorMessage,omitempty"` + // Universally Unique Identifier (UUID). + Id ServerGetIdAttributeType `json:"id,omitempty"` + // Universally Unique Identifier (UUID). + ImageId ServerGetImageIdAttributeType `json:"imageId,omitempty"` + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. + KeypairName ServerGetKeypairNameAttributeType `json:"keypairName,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels ServerGetLabelsAttributeType `json:"labels,omitempty"` + // Date-time when resource was launched. + LaunchedAt ServerGetLaunchedAtAttributeType `json:"launchedAt,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + MachineType ServerGetMachineTypeAttributeType `json:"machineType" required:"true"` + MaintenanceWindow ServerGetMaintenanceWindowAttributeType `json:"maintenanceWindow,omitempty"` + // Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value for a key will remove that key. + Metadata ServerGetMetadataAttributeType `json:"metadata,omitempty"` + // The name for a Server. + // REQUIRED + Name ServerGetNameAttributeType `json:"name" required:"true"` + Networking ServerGetNetworkingAttributeType `json:"networking,omitempty"` + // A list of networks attached to a server. + Nics ServerGetNicsAttributeType `json:"nics,omitempty"` + // The power status of a server. Possible values: `CRASHED`, `ERROR`, `RUNNING`, `STOPPED`. + PowerStatus ServerGetPowerStatusAttributeType `json:"powerStatus,omitempty"` + // A list of General Objects. + SecurityGroups ServerGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` + // A list of service account mails. + ServiceAccountMails ServerGetServiceAccountMailsAttributeType `json:"serviceAccountMails,omitempty"` + // The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, `PAUSED`, `REBOOT`, `REBOOTING`, `REBUILD`, `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, `UNRESCUING`, `UPDATING`. + Status ServerGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt ServerGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // User Data that is provided to the server. Must be base64 encoded and is passed via cloud-init to the server. + UserData ServerGetUserDataAttributeType `json:"userData,omitempty"` + // A list of UUIDs. + Volumes ServerGetVolumesAttributeType `json:"volumes,omitempty"` +} + +type _Server Server + +// NewServer instantiates a new Server object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServer(machineType ServerGetMachineTypeArgType, name ServerGetNameArgType) *Server { + this := Server{} + setServerGetMachineTypeAttributeType(&this.MachineType, machineType) + setServerGetNameAttributeType(&this.Name, name) + return &this +} + +// NewServerWithDefaults instantiates a new Server object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerWithDefaults() *Server { + this := Server{} + return &this +} + +// GetAffinityGroup returns the AffinityGroup field value if set, zero value otherwise. +func (o *Server) GetAffinityGroup() (res ServerGetAffinityGroupRetType) { + res, _ = o.GetAffinityGroupOk() + return +} + +// GetAffinityGroupOk returns a tuple with the AffinityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAffinityGroupOk() (ret ServerGetAffinityGroupRetType, ok bool) { + return getServerGetAffinityGroupAttributeTypeOk(o.AffinityGroup) +} + +// HasAffinityGroup returns a boolean if a field has been set. +func (o *Server) HasAffinityGroup() bool { + _, ok := o.GetAffinityGroupOk() + return ok +} + +// SetAffinityGroup gets a reference to the given string and assigns it to the AffinityGroup field. +func (o *Server) SetAffinityGroup(v ServerGetAffinityGroupRetType) { + setServerGetAffinityGroupAttributeType(&o.AffinityGroup, v) +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *Server) GetAgent() (res ServerGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAgentOk() (ret ServerGetAgentRetType, ok bool) { + return getServerGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *Server) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ServerAgent and assigns it to the Agent field. +func (o *Server) SetAgent(v ServerGetAgentRetType) { + setServerGetAgentAttributeType(&o.Agent, v) +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *Server) GetAvailabilityZone() (res ServerGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetAvailabilityZoneOk() (ret ServerGetAvailabilityZoneRetType, ok bool) { + return getServerGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *Server) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *Server) SetAvailabilityZone(v ServerGetAvailabilityZoneRetType) { + setServerGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootVolume returns the BootVolume field value if set, zero value otherwise. +func (o *Server) GetBootVolume() (res ServerGetBootVolumeRetType) { + res, _ = o.GetBootVolumeOk() + return +} + +// GetBootVolumeOk returns a tuple with the BootVolume field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetBootVolumeOk() (ret ServerGetBootVolumeRetType, ok bool) { + return getServerGetBootVolumeAttributeTypeOk(o.BootVolume) +} + +// HasBootVolume returns a boolean if a field has been set. +func (o *Server) HasBootVolume() bool { + _, ok := o.GetBootVolumeOk() + return ok +} + +// SetBootVolume gets a reference to the given ServerBootVolume and assigns it to the BootVolume field. +func (o *Server) SetBootVolume(v ServerGetBootVolumeRetType) { + setServerGetBootVolumeAttributeType(&o.BootVolume, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Server) GetCreatedAt() (res ServerGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetCreatedAtOk() (ret ServerGetCreatedAtRetType, ok bool) { + return getServerGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Server) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Server) SetCreatedAt(v ServerGetCreatedAtRetType) { + setServerGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise. +func (o *Server) GetErrorMessage() (res ServerGetErrorMessageRetType) { + res, _ = o.GetErrorMessageOk() + return +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetErrorMessageOk() (ret ServerGetErrorMessageRetType, ok bool) { + return getServerGetErrorMessageAttributeTypeOk(o.ErrorMessage) +} + +// HasErrorMessage returns a boolean if a field has been set. +func (o *Server) HasErrorMessage() bool { + _, ok := o.GetErrorMessageOk() + return ok +} + +// SetErrorMessage gets a reference to the given string and assigns it to the ErrorMessage field. +func (o *Server) SetErrorMessage(v ServerGetErrorMessageRetType) { + setServerGetErrorMessageAttributeType(&o.ErrorMessage, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Server) GetId() (res ServerGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetIdOk() (ret ServerGetIdRetType, ok bool) { + return getServerGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Server) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Server) SetId(v ServerGetIdRetType) { + setServerGetIdAttributeType(&o.Id, v) +} + +// GetImageId returns the ImageId field value if set, zero value otherwise. +func (o *Server) GetImageId() (res ServerGetImageIdRetType) { + res, _ = o.GetImageIdOk() + return +} + +// GetImageIdOk returns a tuple with the ImageId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetImageIdOk() (ret ServerGetImageIdRetType, ok bool) { + return getServerGetImageIdAttributeTypeOk(o.ImageId) +} + +// HasImageId returns a boolean if a field has been set. +func (o *Server) HasImageId() bool { + _, ok := o.GetImageIdOk() + return ok +} + +// SetImageId gets a reference to the given string and assigns it to the ImageId field. +func (o *Server) SetImageId(v ServerGetImageIdRetType) { + setServerGetImageIdAttributeType(&o.ImageId, v) +} + +// GetKeypairName returns the KeypairName field value if set, zero value otherwise. +func (o *Server) GetKeypairName() (res ServerGetKeypairNameRetType) { + res, _ = o.GetKeypairNameOk() + return +} + +// GetKeypairNameOk returns a tuple with the KeypairName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetKeypairNameOk() (ret ServerGetKeypairNameRetType, ok bool) { + return getServerGetKeypairNameAttributeTypeOk(o.KeypairName) +} + +// HasKeypairName returns a boolean if a field has been set. +func (o *Server) HasKeypairName() bool { + _, ok := o.GetKeypairNameOk() + return ok +} + +// SetKeypairName gets a reference to the given string and assigns it to the KeypairName field. +func (o *Server) SetKeypairName(v ServerGetKeypairNameRetType) { + setServerGetKeypairNameAttributeType(&o.KeypairName, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Server) GetLabels() (res ServerGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetLabelsOk() (ret ServerGetLabelsRetType, ok bool) { + return getServerGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Server) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Server) SetLabels(v ServerGetLabelsRetType) { + setServerGetLabelsAttributeType(&o.Labels, v) +} + +// GetLaunchedAt returns the LaunchedAt field value if set, zero value otherwise. +func (o *Server) GetLaunchedAt() (res ServerGetLaunchedAtRetType) { + res, _ = o.GetLaunchedAtOk() + return +} + +// GetLaunchedAtOk returns a tuple with the LaunchedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetLaunchedAtOk() (ret ServerGetLaunchedAtRetType, ok bool) { + return getServerGetLaunchedAtAttributeTypeOk(o.LaunchedAt) +} + +// HasLaunchedAt returns a boolean if a field has been set. +func (o *Server) HasLaunchedAt() bool { + _, ok := o.GetLaunchedAtOk() + return ok +} + +// SetLaunchedAt gets a reference to the given time.Time and assigns it to the LaunchedAt field. +func (o *Server) SetLaunchedAt(v ServerGetLaunchedAtRetType) { + setServerGetLaunchedAtAttributeType(&o.LaunchedAt, v) +} + +// GetMachineType returns the MachineType field value +func (o *Server) GetMachineType() (ret ServerGetMachineTypeRetType) { + ret, _ = o.GetMachineTypeOk() + return ret +} + +// GetMachineTypeOk returns a tuple with the MachineType field value +// and a boolean to check if the value has been set. +func (o *Server) GetMachineTypeOk() (ret ServerGetMachineTypeRetType, ok bool) { + return getServerGetMachineTypeAttributeTypeOk(o.MachineType) +} + +// SetMachineType sets field value +func (o *Server) SetMachineType(v ServerGetMachineTypeRetType) { + setServerGetMachineTypeAttributeType(&o.MachineType, v) +} + +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *Server) GetMaintenanceWindow() (res ServerGetMaintenanceWindowRetType) { + res, _ = o.GetMaintenanceWindowOk() + return +} + +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetMaintenanceWindowOk() (ret ServerGetMaintenanceWindowRetType, ok bool) { + return getServerGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow) +} + +// HasMaintenanceWindow returns a boolean if a field has been set. +func (o *Server) HasMaintenanceWindow() bool { + _, ok := o.GetMaintenanceWindowOk() + return ok +} + +// SetMaintenanceWindow gets a reference to the given ServerMaintenance and assigns it to the MaintenanceWindow field. +func (o *Server) SetMaintenanceWindow(v ServerGetMaintenanceWindowRetType) { + setServerGetMaintenanceWindowAttributeType(&o.MaintenanceWindow, v) +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Server) GetMetadata() (res ServerGetMetadataRetType) { + res, _ = o.GetMetadataOk() + return +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetMetadataOk() (ret ServerGetMetadataRetType, ok bool) { + return getServerGetMetadataAttributeTypeOk(o.Metadata) +} + +// HasMetadata returns a boolean if a field has been set. +func (o *Server) HasMetadata() bool { + _, ok := o.GetMetadataOk() + return ok +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *Server) SetMetadata(v ServerGetMetadataRetType) { + setServerGetMetadataAttributeType(&o.Metadata, v) +} + +// GetName returns the Name field value +func (o *Server) GetName() (ret ServerGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Server) GetNameOk() (ret ServerGetNameRetType, ok bool) { + return getServerGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *Server) SetName(v ServerGetNameRetType) { + setServerGetNameAttributeType(&o.Name, v) +} + +// GetNetworking returns the Networking field value if set, zero value otherwise. +func (o *Server) GetNetworking() (res ServerGetNetworkingRetType) { + res, _ = o.GetNetworkingOk() + return +} + +// GetNetworkingOk returns a tuple with the Networking field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetNetworkingOk() (ret ServerGetNetworkingRetType, ok bool) { + return getServerGetNetworkingAttributeTypeOk(o.Networking) +} + +// HasNetworking returns a boolean if a field has been set. +func (o *Server) HasNetworking() bool { + _, ok := o.GetNetworkingOk() + return ok +} + +// SetNetworking gets a reference to the given ServerNetworking and assigns it to the Networking field. +func (o *Server) SetNetworking(v ServerGetNetworkingRetType) { + setServerGetNetworkingAttributeType(&o.Networking, v) +} + +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *Server) GetNics() (res ServerGetNicsRetType) { + res, _ = o.GetNicsOk() + return +} + +// GetNicsOk returns a tuple with the Nics field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetNicsOk() (ret ServerGetNicsRetType, ok bool) { + return getServerGetNicsAttributeTypeOk(o.Nics) +} + +// HasNics returns a boolean if a field has been set. +func (o *Server) HasNics() bool { + _, ok := o.GetNicsOk() + return ok +} + +// SetNics gets a reference to the given []ServerNetwork and assigns it to the Nics field. +func (o *Server) SetNics(v ServerGetNicsRetType) { + setServerGetNicsAttributeType(&o.Nics, v) +} + +// GetPowerStatus returns the PowerStatus field value if set, zero value otherwise. +func (o *Server) GetPowerStatus() (res ServerGetPowerStatusRetType) { + res, _ = o.GetPowerStatusOk() + return +} + +// GetPowerStatusOk returns a tuple with the PowerStatus field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetPowerStatusOk() (ret ServerGetPowerStatusRetType, ok bool) { + return getServerGetPowerStatusAttributeTypeOk(o.PowerStatus) +} + +// HasPowerStatus returns a boolean if a field has been set. +func (o *Server) HasPowerStatus() bool { + _, ok := o.GetPowerStatusOk() + return ok +} + +// SetPowerStatus gets a reference to the given string and assigns it to the PowerStatus field. +func (o *Server) SetPowerStatus(v ServerGetPowerStatusRetType) { + setServerGetPowerStatusAttributeType(&o.PowerStatus, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *Server) GetSecurityGroups() (res ServerGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetSecurityGroupsOk() (ret ServerGetSecurityGroupsRetType, ok bool) { + return getServerGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *Server) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *Server) SetSecurityGroups(v ServerGetSecurityGroupsRetType) { + setServerGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +// GetServiceAccountMails returns the ServiceAccountMails field value if set, zero value otherwise. +func (o *Server) GetServiceAccountMails() (res ServerGetServiceAccountMailsRetType) { + res, _ = o.GetServiceAccountMailsOk() + return +} + +// GetServiceAccountMailsOk returns a tuple with the ServiceAccountMails field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetServiceAccountMailsOk() (ret ServerGetServiceAccountMailsRetType, ok bool) { + return getServerGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails) +} + +// HasServiceAccountMails returns a boolean if a field has been set. +func (o *Server) HasServiceAccountMails() bool { + _, ok := o.GetServiceAccountMailsOk() + return ok +} + +// SetServiceAccountMails gets a reference to the given []string and assigns it to the ServiceAccountMails field. +func (o *Server) SetServiceAccountMails(v ServerGetServiceAccountMailsRetType) { + setServerGetServiceAccountMailsAttributeType(&o.ServiceAccountMails, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Server) GetStatus() (res ServerGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetStatusOk() (ret ServerGetStatusRetType, ok bool) { + return getServerGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Server) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Server) SetStatus(v ServerGetStatusRetType) { + setServerGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Server) GetUpdatedAt() (res ServerGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetUpdatedAtOk() (ret ServerGetUpdatedAtRetType, ok bool) { + return getServerGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Server) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Server) SetUpdatedAt(v ServerGetUpdatedAtRetType) { + setServerGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetUserData returns the UserData field value if set, zero value otherwise. +func (o *Server) GetUserData() (res ServerGetUserDataRetType) { + res, _ = o.GetUserDataOk() + return +} + +// GetUserDataOk returns a tuple with the UserData field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetUserDataOk() (ret ServerGetUserDataRetType, ok bool) { + return getServerGetUserDataAttributeTypeOk(o.UserData) +} + +// HasUserData returns a boolean if a field has been set. +func (o *Server) HasUserData() bool { + _, ok := o.GetUserDataOk() + return ok +} + +// SetUserData gets a reference to the given string and assigns it to the UserData field. +func (o *Server) SetUserData(v ServerGetUserDataRetType) { + setServerGetUserDataAttributeType(&o.UserData, v) +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *Server) GetVolumes() (res ServerGetVolumesRetType) { + res, _ = o.GetVolumesOk() + return +} + +// GetVolumesOk returns a tuple with the Volumes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Server) GetVolumesOk() (ret ServerGetVolumesRetType, ok bool) { + return getServerGetVolumesAttributeTypeOk(o.Volumes) +} + +// HasVolumes returns a boolean if a field has been set. +func (o *Server) HasVolumes() bool { + _, ok := o.GetVolumesOk() + return ok +} + +// SetVolumes gets a reference to the given []string and assigns it to the Volumes field. +func (o *Server) SetVolumes(v ServerGetVolumesRetType) { + setServerGetVolumesAttributeType(&o.Volumes, v) +} + +func (o Server) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerGetAffinityGroupAttributeTypeOk(o.AffinityGroup); ok { + toSerialize["AffinityGroup"] = val + } + if val, ok := getServerGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getServerGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getServerGetBootVolumeAttributeTypeOk(o.BootVolume); ok { + toSerialize["BootVolume"] = val + } + if val, ok := getServerGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getServerGetErrorMessageAttributeTypeOk(o.ErrorMessage); ok { + toSerialize["ErrorMessage"] = val + } + if val, ok := getServerGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getServerGetImageIdAttributeTypeOk(o.ImageId); ok { + toSerialize["ImageId"] = val + } + if val, ok := getServerGetKeypairNameAttributeTypeOk(o.KeypairName); ok { + toSerialize["KeypairName"] = val + } + if val, ok := getServerGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getServerGetLaunchedAtAttributeTypeOk(o.LaunchedAt); ok { + toSerialize["LaunchedAt"] = val + } + if val, ok := getServerGetMachineTypeAttributeTypeOk(o.MachineType); ok { + toSerialize["MachineType"] = val + } + if val, ok := getServerGetMaintenanceWindowAttributeTypeOk(o.MaintenanceWindow); ok { + toSerialize["MaintenanceWindow"] = val + } + if val, ok := getServerGetMetadataAttributeTypeOk(o.Metadata); ok { + toSerialize["Metadata"] = val + } + if val, ok := getServerGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getServerGetNetworkingAttributeTypeOk(o.Networking); ok { + toSerialize["Networking"] = val + } + if val, ok := getServerGetNicsAttributeTypeOk(o.Nics); ok { + toSerialize["Nics"] = val + } + if val, ok := getServerGetPowerStatusAttributeTypeOk(o.PowerStatus); ok { + toSerialize["PowerStatus"] = val + } + if val, ok := getServerGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + if val, ok := getServerGetServiceAccountMailsAttributeTypeOk(o.ServiceAccountMails); ok { + toSerialize["ServiceAccountMails"] = val + } + if val, ok := getServerGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getServerGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getServerGetUserDataAttributeTypeOk(o.UserData); ok { + toSerialize["UserData"] = val + } + if val, ok := getServerGetVolumesAttributeTypeOk(o.Volumes); ok { + toSerialize["Volumes"] = val + } + return toSerialize, nil +} + +type NullableServer struct { + value *Server + isSet bool +} + +func (v NullableServer) Get() *Server { + return v.value +} + +func (v *NullableServer) Set(val *Server) { + v.value = val + v.isSet = true +} + +func (v NullableServer) IsSet() bool { + return v.isSet +} + +func (v *NullableServer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServer(val *Server) *NullableServer { + return &NullableServer{value: val, isSet: true} +} + +func (v NullableServer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_agent.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_agent.go new file mode 100644 index 00000000..163ed849 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_agent.go @@ -0,0 +1,128 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerAgent type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerAgent{} + +/* + types and functions for provisioned +*/ + +// isBoolean +type ServerAgentgetProvisionedAttributeType = *bool +type ServerAgentgetProvisionedArgType = bool +type ServerAgentgetProvisionedRetType = bool + +func getServerAgentgetProvisionedAttributeTypeOk(arg ServerAgentgetProvisionedAttributeType) (ret ServerAgentgetProvisionedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerAgentgetProvisionedAttributeType(arg *ServerAgentgetProvisionedAttributeType, val ServerAgentgetProvisionedRetType) { + *arg = &val +} + +// ServerAgent STACKIT server agent options for a server. +type ServerAgent struct { + // Configure the STACKIT server agent provisioning during the first boot of the server. Only works when booting from an images that supports the STACKIT server agent. When `false` the agent IS NOT installed. When `true` the agent IS installed. When its not set the result depend on the used image and its default provisioning setting. + Provisioned ServerAgentgetProvisionedAttributeType `json:"provisioned,omitempty"` +} + +// NewServerAgent instantiates a new ServerAgent object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServerAgent() *ServerAgent { + this := ServerAgent{} + return &this +} + +// NewServerAgentWithDefaults instantiates a new ServerAgent object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerAgentWithDefaults() *ServerAgent { + this := ServerAgent{} + return &this +} + +// GetProvisioned returns the Provisioned field value if set, zero value otherwise. +func (o *ServerAgent) GetProvisioned() (res ServerAgentgetProvisionedRetType) { + res, _ = o.GetProvisionedOk() + return +} + +// GetProvisionedOk returns a tuple with the Provisioned field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerAgent) GetProvisionedOk() (ret ServerAgentgetProvisionedRetType, ok bool) { + return getServerAgentgetProvisionedAttributeTypeOk(o.Provisioned) +} + +// HasProvisioned returns a boolean if a field has been set. +func (o *ServerAgent) HasProvisioned() bool { + _, ok := o.GetProvisionedOk() + return ok +} + +// SetProvisioned gets a reference to the given bool and assigns it to the Provisioned field. +func (o *ServerAgent) SetProvisioned(v ServerAgentgetProvisionedRetType) { + setServerAgentgetProvisionedAttributeType(&o.Provisioned, v) +} + +func (o ServerAgent) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerAgentgetProvisionedAttributeTypeOk(o.Provisioned); ok { + toSerialize["Provisioned"] = val + } + return toSerialize, nil +} + +type NullableServerAgent struct { + value *ServerAgent + isSet bool +} + +func (v NullableServerAgent) Get() *ServerAgent { + return v.value +} + +func (v *NullableServerAgent) Set(val *ServerAgent) { + v.value = val + v.isSet = true +} + +func (v NullableServerAgent) IsSet() bool { + return v.isSet +} + +func (v *NullableServerAgent) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerAgent(val *ServerAgent) *NullableServerAgent { + return &NullableServerAgent{value: val, isSet: true} +} + +func (v NullableServerAgent) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerAgent) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_boot_volume.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_boot_volume.go new file mode 100644 index 00000000..138cfbfc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_boot_volume.go @@ -0,0 +1,321 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerBootVolume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerBootVolume{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type ServerBootVolumegetDeleteOnTerminationAttributeType = *bool +type ServerBootVolumegetDeleteOnTerminationArgType = bool +type ServerBootVolumegetDeleteOnTerminationRetType = bool + +func getServerBootVolumegetDeleteOnTerminationAttributeTypeOk(arg ServerBootVolumegetDeleteOnTerminationAttributeType) (ret ServerBootVolumegetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumegetDeleteOnTerminationAttributeType(arg *ServerBootVolumegetDeleteOnTerminationAttributeType, val ServerBootVolumegetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type ServerBootVolumeGetIdAttributeType = *string + +func getServerBootVolumeGetIdAttributeTypeOk(arg ServerBootVolumeGetIdAttributeType) (ret ServerBootVolumeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetIdAttributeType(arg *ServerBootVolumeGetIdAttributeType, val ServerBootVolumeGetIdRetType) { + *arg = &val +} + +type ServerBootVolumeGetIdArgType = string +type ServerBootVolumeGetIdRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type ServerBootVolumeGetPerformanceClassAttributeType = *string + +func getServerBootVolumeGetPerformanceClassAttributeTypeOk(arg ServerBootVolumeGetPerformanceClassAttributeType) (ret ServerBootVolumeGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetPerformanceClassAttributeType(arg *ServerBootVolumeGetPerformanceClassAttributeType, val ServerBootVolumeGetPerformanceClassRetType) { + *arg = &val +} + +type ServerBootVolumeGetPerformanceClassArgType = string +type ServerBootVolumeGetPerformanceClassRetType = string + +/* + types and functions for size +*/ + +// isLong +type ServerBootVolumeGetSizeAttributeType = *int64 +type ServerBootVolumeGetSizeArgType = int64 +type ServerBootVolumeGetSizeRetType = int64 + +func getServerBootVolumeGetSizeAttributeTypeOk(arg ServerBootVolumeGetSizeAttributeType) (ret ServerBootVolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetSizeAttributeType(arg *ServerBootVolumeGetSizeAttributeType, val ServerBootVolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type ServerBootVolumeGetSourceAttributeType = *BootVolumeSource +type ServerBootVolumeGetSourceArgType = BootVolumeSource +type ServerBootVolumeGetSourceRetType = BootVolumeSource + +func getServerBootVolumeGetSourceAttributeTypeOk(arg ServerBootVolumeGetSourceAttributeType) (ret ServerBootVolumeGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerBootVolumeGetSourceAttributeType(arg *ServerBootVolumeGetSourceAttributeType, val ServerBootVolumeGetSourceRetType) { + *arg = &val +} + +// ServerBootVolume struct for ServerBootVolume +type ServerBootVolume struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination ServerBootVolumegetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + Id ServerBootVolumeGetIdAttributeType `json:"id,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass ServerBootVolumeGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Size in Gigabyte. + Size ServerBootVolumeGetSizeAttributeType `json:"size,omitempty"` + Source ServerBootVolumeGetSourceAttributeType `json:"source,omitempty"` +} + +// NewServerBootVolume instantiates a new ServerBootVolume object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServerBootVolume() *ServerBootVolume { + this := ServerBootVolume{} + return &this +} + +// NewServerBootVolumeWithDefaults instantiates a new ServerBootVolume object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerBootVolumeWithDefaults() *ServerBootVolume { + this := ServerBootVolume{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *ServerBootVolume) GetDeleteOnTermination() (res ServerBootVolumegetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetDeleteOnTerminationOk() (ret ServerBootVolumegetDeleteOnTerminationRetType, ok bool) { + return getServerBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *ServerBootVolume) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *ServerBootVolume) SetDeleteOnTermination(v ServerBootVolumegetDeleteOnTerminationRetType) { + setServerBootVolumegetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *ServerBootVolume) GetId() (res ServerBootVolumeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetIdOk() (ret ServerBootVolumeGetIdRetType, ok bool) { + return getServerBootVolumeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *ServerBootVolume) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ServerBootVolume) SetId(v ServerBootVolumeGetIdRetType) { + setServerBootVolumeGetIdAttributeType(&o.Id, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *ServerBootVolume) GetPerformanceClass() (res ServerBootVolumeGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetPerformanceClassOk() (ret ServerBootVolumeGetPerformanceClassRetType, ok bool) { + return getServerBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *ServerBootVolume) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *ServerBootVolume) SetPerformanceClass(v ServerBootVolumeGetPerformanceClassRetType) { + setServerBootVolumeGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *ServerBootVolume) GetSize() (res ServerBootVolumeGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetSizeOk() (ret ServerBootVolumeGetSizeRetType, ok bool) { + return getServerBootVolumeGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *ServerBootVolume) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *ServerBootVolume) SetSize(v ServerBootVolumeGetSizeRetType) { + setServerBootVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *ServerBootVolume) GetSource() (res ServerBootVolumeGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerBootVolume) GetSourceOk() (ret ServerBootVolumeGetSourceRetType, ok bool) { + return getServerBootVolumeGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *ServerBootVolume) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given BootVolumeSource and assigns it to the Source field. +func (o *ServerBootVolume) SetSource(v ServerBootVolumeGetSourceRetType) { + setServerBootVolumeGetSourceAttributeType(&o.Source, v) +} + +func (o ServerBootVolume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerBootVolumegetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getServerBootVolumeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getServerBootVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getServerBootVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getServerBootVolumeGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + return toSerialize, nil +} + +type NullableServerBootVolume struct { + value *ServerBootVolume + isSet bool +} + +func (v NullableServerBootVolume) Get() *ServerBootVolume { + return v.value +} + +func (v *NullableServerBootVolume) Set(val *ServerBootVolume) { + v.value = val + v.isSet = true +} + +func (v NullableServerBootVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableServerBootVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerBootVolume(val *ServerBootVolume) *NullableServerBootVolume { + return &NullableServerBootVolume{value: val, isSet: true} +} + +func (v NullableServerBootVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerBootVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_console_url.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_console_url.go new file mode 100644 index 00000000..2e0021af --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_console_url.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerConsoleUrl type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerConsoleUrl{} + +/* + types and functions for url +*/ + +// isNotNullableString +type ServerConsoleUrlGetUrlAttributeType = *string + +func getServerConsoleUrlGetUrlAttributeTypeOk(arg ServerConsoleUrlGetUrlAttributeType) (ret ServerConsoleUrlGetUrlRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerConsoleUrlGetUrlAttributeType(arg *ServerConsoleUrlGetUrlAttributeType, val ServerConsoleUrlGetUrlRetType) { + *arg = &val +} + +type ServerConsoleUrlGetUrlArgType = string +type ServerConsoleUrlGetUrlRetType = string + +// ServerConsoleUrl Object that represents a server console URL. +type ServerConsoleUrl struct { + // REQUIRED + Url ServerConsoleUrlGetUrlAttributeType `json:"url" required:"true"` +} + +type _ServerConsoleUrl ServerConsoleUrl + +// NewServerConsoleUrl instantiates a new ServerConsoleUrl object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServerConsoleUrl(url ServerConsoleUrlGetUrlArgType) *ServerConsoleUrl { + this := ServerConsoleUrl{} + setServerConsoleUrlGetUrlAttributeType(&this.Url, url) + return &this +} + +// NewServerConsoleUrlWithDefaults instantiates a new ServerConsoleUrl object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerConsoleUrlWithDefaults() *ServerConsoleUrl { + this := ServerConsoleUrl{} + return &this +} + +// GetUrl returns the Url field value +func (o *ServerConsoleUrl) GetUrl() (ret ServerConsoleUrlGetUrlRetType) { + ret, _ = o.GetUrlOk() + return ret +} + +// GetUrlOk returns a tuple with the Url field value +// and a boolean to check if the value has been set. +func (o *ServerConsoleUrl) GetUrlOk() (ret ServerConsoleUrlGetUrlRetType, ok bool) { + return getServerConsoleUrlGetUrlAttributeTypeOk(o.Url) +} + +// SetUrl sets field value +func (o *ServerConsoleUrl) SetUrl(v ServerConsoleUrlGetUrlRetType) { + setServerConsoleUrlGetUrlAttributeType(&o.Url, v) +} + +func (o ServerConsoleUrl) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerConsoleUrlGetUrlAttributeTypeOk(o.Url); ok { + toSerialize["Url"] = val + } + return toSerialize, nil +} + +type NullableServerConsoleUrl struct { + value *ServerConsoleUrl + isSet bool +} + +func (v NullableServerConsoleUrl) Get() *ServerConsoleUrl { + return v.value +} + +func (v *NullableServerConsoleUrl) Set(val *ServerConsoleUrl) { + v.value = val + v.isSet = true +} + +func (v NullableServerConsoleUrl) IsSet() bool { + return v.isSet +} + +func (v *NullableServerConsoleUrl) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerConsoleUrl(val *ServerConsoleUrl) *NullableServerConsoleUrl { + return &NullableServerConsoleUrl{value: val, isSet: true} +} + +func (v NullableServerConsoleUrl) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerConsoleUrl) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_list_response.go new file mode 100644 index 00000000..1f2009fc --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ServerListResponseGetItemsAttributeType = *[]Server +type ServerListResponseGetItemsArgType = []Server +type ServerListResponseGetItemsRetType = []Server + +func getServerListResponseGetItemsAttributeTypeOk(arg ServerListResponseGetItemsAttributeType) (ret ServerListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerListResponseGetItemsAttributeType(arg *ServerListResponseGetItemsAttributeType, val ServerListResponseGetItemsRetType) { + *arg = &val +} + +// ServerListResponse Response object for server list request. +type ServerListResponse struct { + // A list of servers. + // REQUIRED + Items ServerListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ServerListResponse ServerListResponse + +// NewServerListResponse instantiates a new ServerListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServerListResponse(items ServerListResponseGetItemsArgType) *ServerListResponse { + this := ServerListResponse{} + setServerListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewServerListResponseWithDefaults instantiates a new ServerListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerListResponseWithDefaults() *ServerListResponse { + this := ServerListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ServerListResponse) GetItems() (ret ServerListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ServerListResponse) GetItemsOk() (ret ServerListResponseGetItemsRetType, ok bool) { + return getServerListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ServerListResponse) SetItems(v ServerListResponseGetItemsRetType) { + setServerListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ServerListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableServerListResponse struct { + value *ServerListResponse + isSet bool +} + +func (v NullableServerListResponse) Get() *ServerListResponse { + return v.value +} + +func (v *NullableServerListResponse) Set(val *ServerListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableServerListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServerListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerListResponse(val *ServerListResponse) *NullableServerListResponse { + return &NullableServerListResponse{value: val, isSet: true} +} + +func (v NullableServerListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_maintenance.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_maintenance.go new file mode 100644 index 00000000..fb47dc2e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_maintenance.go @@ -0,0 +1,264 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the ServerMaintenance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerMaintenance{} + +/* + types and functions for details +*/ + +// isNotNullableString +type ServerMaintenanceGetDetailsAttributeType = *string + +func getServerMaintenanceGetDetailsAttributeTypeOk(arg ServerMaintenanceGetDetailsAttributeType) (ret ServerMaintenanceGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetDetailsAttributeType(arg *ServerMaintenanceGetDetailsAttributeType, val ServerMaintenanceGetDetailsRetType) { + *arg = &val +} + +type ServerMaintenanceGetDetailsArgType = string +type ServerMaintenanceGetDetailsRetType = string + +/* + types and functions for endsAt +*/ + +// isDateTime +type ServerMaintenanceGetEndsAtAttributeType = *time.Time +type ServerMaintenanceGetEndsAtArgType = time.Time +type ServerMaintenanceGetEndsAtRetType = time.Time + +func getServerMaintenanceGetEndsAtAttributeTypeOk(arg ServerMaintenanceGetEndsAtAttributeType) (ret ServerMaintenanceGetEndsAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetEndsAtAttributeType(arg *ServerMaintenanceGetEndsAtAttributeType, val ServerMaintenanceGetEndsAtRetType) { + *arg = &val +} + +/* + types and functions for startsAt +*/ + +// isDateTime +type ServerMaintenanceGetStartsAtAttributeType = *time.Time +type ServerMaintenanceGetStartsAtArgType = time.Time +type ServerMaintenanceGetStartsAtRetType = time.Time + +func getServerMaintenanceGetStartsAtAttributeTypeOk(arg ServerMaintenanceGetStartsAtAttributeType) (ret ServerMaintenanceGetStartsAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetStartsAtAttributeType(arg *ServerMaintenanceGetStartsAtAttributeType, val ServerMaintenanceGetStartsAtRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type ServerMaintenanceGetStatusAttributeType = *string + +func getServerMaintenanceGetStatusAttributeTypeOk(arg ServerMaintenanceGetStatusAttributeType) (ret ServerMaintenanceGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerMaintenanceGetStatusAttributeType(arg *ServerMaintenanceGetStatusAttributeType, val ServerMaintenanceGetStatusRetType) { + *arg = &val +} + +type ServerMaintenanceGetStatusArgType = string +type ServerMaintenanceGetStatusRetType = string + +// ServerMaintenance Object that represents the information about the next planned server maintenance window. +type ServerMaintenance struct { + Details ServerMaintenanceGetDetailsAttributeType `json:"details,omitempty"` + // End of the maintenance window. + // REQUIRED + EndsAt ServerMaintenanceGetEndsAtAttributeType `json:"endsAt" required:"true"` + // Start of the maintenance window. + // REQUIRED + StartsAt ServerMaintenanceGetStartsAtAttributeType `json:"startsAt" required:"true"` + // Possible values: `PLANNED`, `ONGOING`. + // REQUIRED + Status ServerMaintenanceGetStatusAttributeType `json:"status" required:"true"` +} + +type _ServerMaintenance ServerMaintenance + +// NewServerMaintenance instantiates a new ServerMaintenance object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServerMaintenance(endsAt ServerMaintenanceGetEndsAtArgType, startsAt ServerMaintenanceGetStartsAtArgType, status ServerMaintenanceGetStatusArgType) *ServerMaintenance { + this := ServerMaintenance{} + setServerMaintenanceGetEndsAtAttributeType(&this.EndsAt, endsAt) + setServerMaintenanceGetStartsAtAttributeType(&this.StartsAt, startsAt) + setServerMaintenanceGetStatusAttributeType(&this.Status, status) + return &this +} + +// NewServerMaintenanceWithDefaults instantiates a new ServerMaintenance object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerMaintenanceWithDefaults() *ServerMaintenance { + this := ServerMaintenance{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *ServerMaintenance) GetDetails() (res ServerMaintenanceGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetDetailsOk() (ret ServerMaintenanceGetDetailsRetType, ok bool) { + return getServerMaintenanceGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *ServerMaintenance) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given string and assigns it to the Details field. +func (o *ServerMaintenance) SetDetails(v ServerMaintenanceGetDetailsRetType) { + setServerMaintenanceGetDetailsAttributeType(&o.Details, v) +} + +// GetEndsAt returns the EndsAt field value +func (o *ServerMaintenance) GetEndsAt() (ret ServerMaintenanceGetEndsAtRetType) { + ret, _ = o.GetEndsAtOk() + return ret +} + +// GetEndsAtOk returns a tuple with the EndsAt field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetEndsAtOk() (ret ServerMaintenanceGetEndsAtRetType, ok bool) { + return getServerMaintenanceGetEndsAtAttributeTypeOk(o.EndsAt) +} + +// SetEndsAt sets field value +func (o *ServerMaintenance) SetEndsAt(v ServerMaintenanceGetEndsAtRetType) { + setServerMaintenanceGetEndsAtAttributeType(&o.EndsAt, v) +} + +// GetStartsAt returns the StartsAt field value +func (o *ServerMaintenance) GetStartsAt() (ret ServerMaintenanceGetStartsAtRetType) { + ret, _ = o.GetStartsAtOk() + return ret +} + +// GetStartsAtOk returns a tuple with the StartsAt field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetStartsAtOk() (ret ServerMaintenanceGetStartsAtRetType, ok bool) { + return getServerMaintenanceGetStartsAtAttributeTypeOk(o.StartsAt) +} + +// SetStartsAt sets field value +func (o *ServerMaintenance) SetStartsAt(v ServerMaintenanceGetStartsAtRetType) { + setServerMaintenanceGetStartsAtAttributeType(&o.StartsAt, v) +} + +// GetStatus returns the Status field value +func (o *ServerMaintenance) GetStatus() (ret ServerMaintenanceGetStatusRetType) { + ret, _ = o.GetStatusOk() + return ret +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *ServerMaintenance) GetStatusOk() (ret ServerMaintenanceGetStatusRetType, ok bool) { + return getServerMaintenanceGetStatusAttributeTypeOk(o.Status) +} + +// SetStatus sets field value +func (o *ServerMaintenance) SetStatus(v ServerMaintenanceGetStatusRetType) { + setServerMaintenanceGetStatusAttributeType(&o.Status, v) +} + +func (o ServerMaintenance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerMaintenanceGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getServerMaintenanceGetEndsAtAttributeTypeOk(o.EndsAt); ok { + toSerialize["EndsAt"] = val + } + if val, ok := getServerMaintenanceGetStartsAtAttributeTypeOk(o.StartsAt); ok { + toSerialize["StartsAt"] = val + } + if val, ok := getServerMaintenanceGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableServerMaintenance struct { + value *ServerMaintenance + isSet bool +} + +func (v NullableServerMaintenance) Get() *ServerMaintenance { + return v.value +} + +func (v *NullableServerMaintenance) Set(val *ServerMaintenance) { + v.value = val + v.isSet = true +} + +func (v NullableServerMaintenance) IsSet() bool { + return v.isSet +} + +func (v *NullableServerMaintenance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerMaintenance(val *ServerMaintenance) *NullableServerMaintenance { + return &NullableServerMaintenance{value: val, isSet: true} +} + +func (v NullableServerMaintenance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerMaintenance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_network.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_network.go new file mode 100644 index 00000000..ddf22139 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_network.go @@ -0,0 +1,549 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServerNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerNetwork{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type ServerNetworkGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type ServerNetworkGetAllowedAddressesArgType = []AllowedAddressesInner +type ServerNetworkGetAllowedAddressesRetType = []AllowedAddressesInner + +func getServerNetworkGetAllowedAddressesAttributeTypeOk(arg ServerNetworkGetAllowedAddressesAttributeType) (ret ServerNetworkGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetAllowedAddressesAttributeType(arg *ServerNetworkGetAllowedAddressesAttributeType, val ServerNetworkGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for ipv4 +*/ + +// isNotNullableString +type ServerNetworkGetIpv4AttributeType = *string + +func getServerNetworkGetIpv4AttributeTypeOk(arg ServerNetworkGetIpv4AttributeType) (ret ServerNetworkGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetIpv4AttributeType(arg *ServerNetworkGetIpv4AttributeType, val ServerNetworkGetIpv4RetType) { + *arg = &val +} + +type ServerNetworkGetIpv4ArgType = string +type ServerNetworkGetIpv4RetType = string + +/* + types and functions for ipv6 +*/ + +// isNotNullableString +type ServerNetworkGetIpv6AttributeType = *string + +func getServerNetworkGetIpv6AttributeTypeOk(arg ServerNetworkGetIpv6AttributeType) (ret ServerNetworkGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetIpv6AttributeType(arg *ServerNetworkGetIpv6AttributeType, val ServerNetworkGetIpv6RetType) { + *arg = &val +} + +type ServerNetworkGetIpv6ArgType = string +type ServerNetworkGetIpv6RetType = string + +/* + types and functions for mac +*/ + +// isNotNullableString +type ServerNetworkGetMacAttributeType = *string + +func getServerNetworkGetMacAttributeTypeOk(arg ServerNetworkGetMacAttributeType) (ret ServerNetworkGetMacRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetMacAttributeType(arg *ServerNetworkGetMacAttributeType, val ServerNetworkGetMacRetType) { + *arg = &val +} + +type ServerNetworkGetMacArgType = string +type ServerNetworkGetMacRetType = string + +/* + types and functions for networkId +*/ + +// isNotNullableString +type ServerNetworkGetNetworkIdAttributeType = *string + +func getServerNetworkGetNetworkIdAttributeTypeOk(arg ServerNetworkGetNetworkIdAttributeType) (ret ServerNetworkGetNetworkIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetNetworkIdAttributeType(arg *ServerNetworkGetNetworkIdAttributeType, val ServerNetworkGetNetworkIdRetType) { + *arg = &val +} + +type ServerNetworkGetNetworkIdArgType = string +type ServerNetworkGetNetworkIdRetType = string + +/* + types and functions for networkName +*/ + +// isNotNullableString +type ServerNetworkGetNetworkNameAttributeType = *string + +func getServerNetworkGetNetworkNameAttributeTypeOk(arg ServerNetworkGetNetworkNameAttributeType) (ret ServerNetworkGetNetworkNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetNetworkNameAttributeType(arg *ServerNetworkGetNetworkNameAttributeType, val ServerNetworkGetNetworkNameRetType) { + *arg = &val +} + +type ServerNetworkGetNetworkNameArgType = string +type ServerNetworkGetNetworkNameRetType = string + +/* + types and functions for nicId +*/ + +// isNotNullableString +type ServerNetworkGetNicIdAttributeType = *string + +func getServerNetworkGetNicIdAttributeTypeOk(arg ServerNetworkGetNicIdAttributeType) (ret ServerNetworkGetNicIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetNicIdAttributeType(arg *ServerNetworkGetNicIdAttributeType, val ServerNetworkGetNicIdRetType) { + *arg = &val +} + +type ServerNetworkGetNicIdArgType = string +type ServerNetworkGetNicIdRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type ServerNetworkgetNicSecurityAttributeType = *bool +type ServerNetworkgetNicSecurityArgType = bool +type ServerNetworkgetNicSecurityRetType = bool + +func getServerNetworkgetNicSecurityAttributeTypeOk(arg ServerNetworkgetNicSecurityAttributeType) (ret ServerNetworkgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkgetNicSecurityAttributeType(arg *ServerNetworkgetNicSecurityAttributeType, val ServerNetworkgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for publicIp +*/ + +// isNotNullableString +type ServerNetworkGetPublicIpAttributeType = *string + +func getServerNetworkGetPublicIpAttributeTypeOk(arg ServerNetworkGetPublicIpAttributeType) (ret ServerNetworkGetPublicIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetPublicIpAttributeType(arg *ServerNetworkGetPublicIpAttributeType, val ServerNetworkGetPublicIpRetType) { + *arg = &val +} + +type ServerNetworkGetPublicIpArgType = string +type ServerNetworkGetPublicIpRetType = string + +/* + types and functions for securityGroups +*/ + +// isArray +type ServerNetworkGetSecurityGroupsAttributeType = *[]string +type ServerNetworkGetSecurityGroupsArgType = []string +type ServerNetworkGetSecurityGroupsRetType = []string + +func getServerNetworkGetSecurityGroupsAttributeTypeOk(arg ServerNetworkGetSecurityGroupsAttributeType) (ret ServerNetworkGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServerNetworkGetSecurityGroupsAttributeType(arg *ServerNetworkGetSecurityGroupsAttributeType, val ServerNetworkGetSecurityGroupsRetType) { + *arg = &val +} + +// ServerNetwork Describes the object that matches servers to its networks. +type ServerNetwork struct { + // A list of IPs or CIDR notations. + AllowedAddresses ServerNetworkGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Object that represents an IP address. + Ipv4 ServerNetworkGetIpv4AttributeType `json:"ipv4,omitempty"` + // String that represents an IPv6 address. + Ipv6 ServerNetworkGetIpv6AttributeType `json:"ipv6,omitempty"` + // Object that represents an MAC address. + // REQUIRED + Mac ServerNetworkGetMacAttributeType `json:"mac" required:"true"` + // Universally Unique Identifier (UUID). + // REQUIRED + NetworkId ServerNetworkGetNetworkIdAttributeType `json:"networkId" required:"true"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + NetworkName ServerNetworkGetNetworkNameAttributeType `json:"networkName" required:"true"` + // Universally Unique Identifier (UUID). + // REQUIRED + NicId ServerNetworkGetNicIdAttributeType `json:"nicId" required:"true"` + // If this is set to false, then no security groups will apply to this server network interface. + // REQUIRED + NicSecurity ServerNetworkgetNicSecurityAttributeType `json:"nicSecurity" required:"true"` + // Object that represents an IP address. + PublicIp ServerNetworkGetPublicIpAttributeType `json:"publicIp,omitempty"` + // A list of UUIDs. + SecurityGroups ServerNetworkGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` +} + +type _ServerNetwork ServerNetwork + +// NewServerNetwork instantiates a new ServerNetwork object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServerNetwork(mac ServerNetworkGetMacArgType, networkId ServerNetworkGetNetworkIdArgType, networkName ServerNetworkGetNetworkNameArgType, nicId ServerNetworkGetNicIdArgType, nicSecurity ServerNetworkgetNicSecurityArgType) *ServerNetwork { + this := ServerNetwork{} + setServerNetworkGetMacAttributeType(&this.Mac, mac) + setServerNetworkGetNetworkIdAttributeType(&this.NetworkId, networkId) + setServerNetworkGetNetworkNameAttributeType(&this.NetworkName, networkName) + setServerNetworkGetNicIdAttributeType(&this.NicId, nicId) + setServerNetworkgetNicSecurityAttributeType(&this.NicSecurity, nicSecurity) + return &this +} + +// NewServerNetworkWithDefaults instantiates a new ServerNetwork object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServerNetworkWithDefaults() *ServerNetwork { + this := ServerNetwork{} + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *ServerNetwork) GetAllowedAddresses() (res ServerNetworkGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetAllowedAddressesOk() (ret ServerNetworkGetAllowedAddressesRetType, ok bool) { + return getServerNetworkGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *ServerNetwork) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *ServerNetwork) SetAllowedAddresses(v ServerNetworkGetAllowedAddressesRetType) { + setServerNetworkGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *ServerNetwork) GetIpv4() (res ServerNetworkGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetIpv4Ok() (ret ServerNetworkGetIpv4RetType, ok bool) { + return getServerNetworkGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *ServerNetwork) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given string and assigns it to the Ipv4 field. +func (o *ServerNetwork) SetIpv4(v ServerNetworkGetIpv4RetType) { + setServerNetworkGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *ServerNetwork) GetIpv6() (res ServerNetworkGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetIpv6Ok() (ret ServerNetworkGetIpv6RetType, ok bool) { + return getServerNetworkGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *ServerNetwork) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given string and assigns it to the Ipv6 field. +func (o *ServerNetwork) SetIpv6(v ServerNetworkGetIpv6RetType) { + setServerNetworkGetIpv6AttributeType(&o.Ipv6, v) +} + +// GetMac returns the Mac field value +func (o *ServerNetwork) GetMac() (ret ServerNetworkGetMacRetType) { + ret, _ = o.GetMacOk() + return ret +} + +// GetMacOk returns a tuple with the Mac field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetMacOk() (ret ServerNetworkGetMacRetType, ok bool) { + return getServerNetworkGetMacAttributeTypeOk(o.Mac) +} + +// SetMac sets field value +func (o *ServerNetwork) SetMac(v ServerNetworkGetMacRetType) { + setServerNetworkGetMacAttributeType(&o.Mac, v) +} + +// GetNetworkId returns the NetworkId field value +func (o *ServerNetwork) GetNetworkId() (ret ServerNetworkGetNetworkIdRetType) { + ret, _ = o.GetNetworkIdOk() + return ret +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNetworkIdOk() (ret ServerNetworkGetNetworkIdRetType, ok bool) { + return getServerNetworkGetNetworkIdAttributeTypeOk(o.NetworkId) +} + +// SetNetworkId sets field value +func (o *ServerNetwork) SetNetworkId(v ServerNetworkGetNetworkIdRetType) { + setServerNetworkGetNetworkIdAttributeType(&o.NetworkId, v) +} + +// GetNetworkName returns the NetworkName field value +func (o *ServerNetwork) GetNetworkName() (ret ServerNetworkGetNetworkNameRetType) { + ret, _ = o.GetNetworkNameOk() + return ret +} + +// GetNetworkNameOk returns a tuple with the NetworkName field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNetworkNameOk() (ret ServerNetworkGetNetworkNameRetType, ok bool) { + return getServerNetworkGetNetworkNameAttributeTypeOk(o.NetworkName) +} + +// SetNetworkName sets field value +func (o *ServerNetwork) SetNetworkName(v ServerNetworkGetNetworkNameRetType) { + setServerNetworkGetNetworkNameAttributeType(&o.NetworkName, v) +} + +// GetNicId returns the NicId field value +func (o *ServerNetwork) GetNicId() (ret ServerNetworkGetNicIdRetType) { + ret, _ = o.GetNicIdOk() + return ret +} + +// GetNicIdOk returns a tuple with the NicId field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNicIdOk() (ret ServerNetworkGetNicIdRetType, ok bool) { + return getServerNetworkGetNicIdAttributeTypeOk(o.NicId) +} + +// SetNicId sets field value +func (o *ServerNetwork) SetNicId(v ServerNetworkGetNicIdRetType) { + setServerNetworkGetNicIdAttributeType(&o.NicId, v) +} + +// GetNicSecurity returns the NicSecurity field value +func (o *ServerNetwork) GetNicSecurity() (ret ServerNetworkgetNicSecurityRetType) { + ret, _ = o.GetNicSecurityOk() + return ret +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetNicSecurityOk() (ret ServerNetworkgetNicSecurityRetType, ok bool) { + return getServerNetworkgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// SetNicSecurity sets field value +func (o *ServerNetwork) SetNicSecurity(v ServerNetworkgetNicSecurityRetType) { + setServerNetworkgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetPublicIp returns the PublicIp field value if set, zero value otherwise. +func (o *ServerNetwork) GetPublicIp() (res ServerNetworkGetPublicIpRetType) { + res, _ = o.GetPublicIpOk() + return +} + +// GetPublicIpOk returns a tuple with the PublicIp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetPublicIpOk() (ret ServerNetworkGetPublicIpRetType, ok bool) { + return getServerNetworkGetPublicIpAttributeTypeOk(o.PublicIp) +} + +// HasPublicIp returns a boolean if a field has been set. +func (o *ServerNetwork) HasPublicIp() bool { + _, ok := o.GetPublicIpOk() + return ok +} + +// SetPublicIp gets a reference to the given string and assigns it to the PublicIp field. +func (o *ServerNetwork) SetPublicIp(v ServerNetworkGetPublicIpRetType) { + setServerNetworkGetPublicIpAttributeType(&o.PublicIp, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *ServerNetwork) GetSecurityGroups() (res ServerNetworkGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerNetwork) GetSecurityGroupsOk() (ret ServerNetworkGetSecurityGroupsRetType, ok bool) { + return getServerNetworkGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *ServerNetwork) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *ServerNetwork) SetSecurityGroups(v ServerNetworkGetSecurityGroupsRetType) { + setServerNetworkGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +func (o ServerNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServerNetworkGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getServerNetworkGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getServerNetworkGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + if val, ok := getServerNetworkGetMacAttributeTypeOk(o.Mac); ok { + toSerialize["Mac"] = val + } + if val, ok := getServerNetworkGetNetworkIdAttributeTypeOk(o.NetworkId); ok { + toSerialize["NetworkId"] = val + } + if val, ok := getServerNetworkGetNetworkNameAttributeTypeOk(o.NetworkName); ok { + toSerialize["NetworkName"] = val + } + if val, ok := getServerNetworkGetNicIdAttributeTypeOk(o.NicId); ok { + toSerialize["NicId"] = val + } + if val, ok := getServerNetworkgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getServerNetworkGetPublicIpAttributeTypeOk(o.PublicIp); ok { + toSerialize["PublicIp"] = val + } + if val, ok := getServerNetworkGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + return toSerialize, nil +} + +type NullableServerNetwork struct { + value *ServerNetwork + isSet bool +} + +func (v NullableServerNetwork) Get() *ServerNetwork { + return v.value +} + +func (v *NullableServerNetwork) Set(val *ServerNetwork) { + v.value = val + v.isSet = true +} + +func (v NullableServerNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullableServerNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerNetwork(val *ServerNetwork) *NullableServerNetwork { + return &NullableServerNetwork{value: val, isSet: true} +} + +func (v NullableServerNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_networking.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_networking.go new file mode 100644 index 00000000..358eb596 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_server_networking.go @@ -0,0 +1,144 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// ServerNetworking - The initial networking setup for the server creation. A network, a nic or nothing can be given. +type ServerNetworking struct { + CreateServerNetworking *CreateServerNetworking + CreateServerNetworkingWithNics *CreateServerNetworkingWithNics +} + +// CreateServerNetworkingAsServerNetworking is a convenience function that returns CreateServerNetworking wrapped in ServerNetworking +func CreateServerNetworkingAsServerNetworking(v *CreateServerNetworking) ServerNetworking { + return ServerNetworking{ + CreateServerNetworking: v, + } +} + +// CreateServerNetworkingWithNicsAsServerNetworking is a convenience function that returns CreateServerNetworkingWithNics wrapped in ServerNetworking +func CreateServerNetworkingWithNicsAsServerNetworking(v *CreateServerNetworkingWithNics) ServerNetworking { + return ServerNetworking{ + CreateServerNetworkingWithNics: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ServerNetworking) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // Workaround until upstream issue is fixed: + // https://github.com/OpenAPITools/openapi-generator/issues/21751 + // Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-226 + // try to unmarshal data into CreateServerNetworking + dstServerNetworking1 := &ServerNetworking{} + err = json.Unmarshal(data, &dstServerNetworking1.CreateServerNetworking) + if err == nil { + jsonCreateServerNetworking, _ := json.Marshal(&dstServerNetworking1.CreateServerNetworking) + if string(jsonCreateServerNetworking) != "{}" { // empty struct + dst.CreateServerNetworking = dstServerNetworking1.CreateServerNetworking + match++ + } + } + + // try to unmarshal data into CreateServerNetworkingWithNics + dstServerNetworking2 := &ServerNetworking{} + err = json.Unmarshal(data, &dstServerNetworking2.CreateServerNetworkingWithNics) + if err == nil { + jsonCreateServerNetworkingWithNics, _ := json.Marshal(&dstServerNetworking2.CreateServerNetworkingWithNics) + if string(jsonCreateServerNetworkingWithNics) != "{}" { // empty struct + dst.CreateServerNetworkingWithNics = dstServerNetworking2.CreateServerNetworkingWithNics + match++ + } + } + + if match > 1 { // more than 1 match + // reset to nil + dst.CreateServerNetworking = nil + dst.CreateServerNetworkingWithNics = nil + + return fmt.Errorf("data matches more than one schema in oneOf(ServerNetworking)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(ServerNetworking)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ServerNetworking) MarshalJSON() ([]byte, error) { + if src.CreateServerNetworking != nil { + return json.Marshal(&src.CreateServerNetworking) + } + + if src.CreateServerNetworkingWithNics != nil { + return json.Marshal(&src.CreateServerNetworkingWithNics) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ServerNetworking) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.CreateServerNetworking != nil { + return obj.CreateServerNetworking + } + + if obj.CreateServerNetworkingWithNics != nil { + return obj.CreateServerNetworkingWithNics + } + + // all schemas are nil + return nil +} + +type NullableServerNetworking struct { + value *ServerNetworking + isSet bool +} + +func (v NullableServerNetworking) Get() *ServerNetworking { + return v.value +} + +func (v *NullableServerNetworking) Set(val *ServerNetworking) { + v.value = val + v.isSet = true +} + +func (v NullableServerNetworking) IsSet() bool { + return v.isSet +} + +func (v *NullableServerNetworking) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServerNetworking(val *ServerNetworking) *NullableServerNetworking { + return &NullableServerNetworking{value: val, isSet: true} +} + +func (v NullableServerNetworking) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServerNetworking) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_service_account_mail_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_service_account_mail_list_response.go new file mode 100644 index 00000000..d22791fd --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_service_account_mail_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the ServiceAccountMailListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServiceAccountMailListResponse{} + +/* + types and functions for items +*/ + +// isArray +type ServiceAccountMailListResponseGetItemsAttributeType = *[]string +type ServiceAccountMailListResponseGetItemsArgType = []string +type ServiceAccountMailListResponseGetItemsRetType = []string + +func getServiceAccountMailListResponseGetItemsAttributeTypeOk(arg ServiceAccountMailListResponseGetItemsAttributeType) (ret ServiceAccountMailListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServiceAccountMailListResponseGetItemsAttributeType(arg *ServiceAccountMailListResponseGetItemsAttributeType, val ServiceAccountMailListResponseGetItemsRetType) { + *arg = &val +} + +// ServiceAccountMailListResponse Service account mail list response. +type ServiceAccountMailListResponse struct { + // A list of service account mails. + // REQUIRED + Items ServiceAccountMailListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _ServiceAccountMailListResponse ServiceAccountMailListResponse + +// NewServiceAccountMailListResponse instantiates a new ServiceAccountMailListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewServiceAccountMailListResponse(items ServiceAccountMailListResponseGetItemsArgType) *ServiceAccountMailListResponse { + this := ServiceAccountMailListResponse{} + setServiceAccountMailListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewServiceAccountMailListResponseWithDefaults instantiates a new ServiceAccountMailListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewServiceAccountMailListResponseWithDefaults() *ServiceAccountMailListResponse { + this := ServiceAccountMailListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ServiceAccountMailListResponse) GetItems() (ret ServiceAccountMailListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ServiceAccountMailListResponse) GetItemsOk() (ret ServiceAccountMailListResponseGetItemsRetType, ok bool) { + return getServiceAccountMailListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *ServiceAccountMailListResponse) SetItems(v ServiceAccountMailListResponseGetItemsRetType) { + setServiceAccountMailListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o ServiceAccountMailListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServiceAccountMailListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableServiceAccountMailListResponse struct { + value *ServiceAccountMailListResponse + isSet bool +} + +func (v NullableServiceAccountMailListResponse) Get() *ServiceAccountMailListResponse { + return v.value +} + +func (v *NullableServiceAccountMailListResponse) Set(val *ServiceAccountMailListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableServiceAccountMailListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceAccountMailListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceAccountMailListResponse(val *ServiceAccountMailListResponse) *NullableServiceAccountMailListResponse { + return &NullableServiceAccountMailListResponse{value: val, isSet: true} +} + +func (v NullableServiceAccountMailListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceAccountMailListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_set_image_share_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_set_image_share_payload.go new file mode 100644 index 00000000..ee7fc82e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_set_image_share_payload.go @@ -0,0 +1,176 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SetImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SetImageSharePayload{} + +/* + types and functions for parentOrganization +*/ + +// isBoolean +type SetImageSharePayloadgetParentOrganizationAttributeType = *bool +type SetImageSharePayloadgetParentOrganizationArgType = bool +type SetImageSharePayloadgetParentOrganizationRetType = bool + +func getSetImageSharePayloadgetParentOrganizationAttributeTypeOk(arg SetImageSharePayloadgetParentOrganizationAttributeType) (ret SetImageSharePayloadgetParentOrganizationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSetImageSharePayloadgetParentOrganizationAttributeType(arg *SetImageSharePayloadgetParentOrganizationAttributeType, val SetImageSharePayloadgetParentOrganizationRetType) { + *arg = &val +} + +/* + types and functions for projects +*/ + +// isArray +type SetImageSharePayloadGetProjectsAttributeType = *[]string +type SetImageSharePayloadGetProjectsArgType = []string +type SetImageSharePayloadGetProjectsRetType = []string + +func getSetImageSharePayloadGetProjectsAttributeTypeOk(arg SetImageSharePayloadGetProjectsAttributeType) (ret SetImageSharePayloadGetProjectsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSetImageSharePayloadGetProjectsAttributeType(arg *SetImageSharePayloadGetProjectsAttributeType, val SetImageSharePayloadGetProjectsRetType) { + *arg = &val +} + +// SetImageSharePayload Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type SetImageSharePayload struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization SetImageSharePayloadgetParentOrganizationAttributeType `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects SetImageSharePayloadGetProjectsAttributeType `json:"projects,omitempty"` +} + +// NewSetImageSharePayload instantiates a new SetImageSharePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSetImageSharePayload() *SetImageSharePayload { + this := SetImageSharePayload{} + return &this +} + +// NewSetImageSharePayloadWithDefaults instantiates a new SetImageSharePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSetImageSharePayloadWithDefaults() *SetImageSharePayload { + this := SetImageSharePayload{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *SetImageSharePayload) GetParentOrganization() (res SetImageSharePayloadgetParentOrganizationRetType) { + res, _ = o.GetParentOrganizationOk() + return +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SetImageSharePayload) GetParentOrganizationOk() (ret SetImageSharePayloadgetParentOrganizationRetType, ok bool) { + return getSetImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization) +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *SetImageSharePayload) HasParentOrganization() bool { + _, ok := o.GetParentOrganizationOk() + return ok +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *SetImageSharePayload) SetParentOrganization(v SetImageSharePayloadgetParentOrganizationRetType) { + setSetImageSharePayloadgetParentOrganizationAttributeType(&o.ParentOrganization, v) +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *SetImageSharePayload) GetProjects() (res SetImageSharePayloadGetProjectsRetType) { + res, _ = o.GetProjectsOk() + return +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SetImageSharePayload) GetProjectsOk() (ret SetImageSharePayloadGetProjectsRetType, ok bool) { + return getSetImageSharePayloadGetProjectsAttributeTypeOk(o.Projects) +} + +// HasProjects returns a boolean if a field has been set. +func (o *SetImageSharePayload) HasProjects() bool { + _, ok := o.GetProjectsOk() + return ok +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *SetImageSharePayload) SetProjects(v SetImageSharePayloadGetProjectsRetType) { + setSetImageSharePayloadGetProjectsAttributeType(&o.Projects, v) +} + +func (o SetImageSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSetImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization); ok { + toSerialize["ParentOrganization"] = val + } + if val, ok := getSetImageSharePayloadGetProjectsAttributeTypeOk(o.Projects); ok { + toSerialize["Projects"] = val + } + return toSerialize, nil +} + +type NullableSetImageSharePayload struct { + value *SetImageSharePayload + isSet bool +} + +func (v NullableSetImageSharePayload) Get() *SetImageSharePayload { + return v.value +} + +func (v *NullableSetImageSharePayload) Set(val *SetImageSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableSetImageSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableSetImageSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSetImageSharePayload(val *SetImageSharePayload) *NullableSetImageSharePayload { + return &NullableSetImageSharePayload{value: val, isSet: true} +} + +func (v NullableSetImageSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSetImageSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_snapshot.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_snapshot.go new file mode 100644 index 00000000..29057c6c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_snapshot.go @@ -0,0 +1,467 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Snapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Snapshot{} + +/* + types and functions for createdAt +*/ + +// isDateTime +type SnapshotGetCreatedAtAttributeType = *time.Time +type SnapshotGetCreatedAtArgType = time.Time +type SnapshotGetCreatedAtRetType = time.Time + +func getSnapshotGetCreatedAtAttributeTypeOk(arg SnapshotGetCreatedAtAttributeType) (ret SnapshotGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetCreatedAtAttributeType(arg *SnapshotGetCreatedAtAttributeType, val SnapshotGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type SnapshotGetIdAttributeType = *string + +func getSnapshotGetIdAttributeTypeOk(arg SnapshotGetIdAttributeType) (ret SnapshotGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetIdAttributeType(arg *SnapshotGetIdAttributeType, val SnapshotGetIdRetType) { + *arg = &val +} + +type SnapshotGetIdArgType = string +type SnapshotGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type SnapshotGetLabelsAttributeType = *map[string]interface{} +type SnapshotGetLabelsArgType = map[string]interface{} +type SnapshotGetLabelsRetType = map[string]interface{} + +func getSnapshotGetLabelsAttributeTypeOk(arg SnapshotGetLabelsAttributeType) (ret SnapshotGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetLabelsAttributeType(arg *SnapshotGetLabelsAttributeType, val SnapshotGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type SnapshotGetNameAttributeType = *string + +func getSnapshotGetNameAttributeTypeOk(arg SnapshotGetNameAttributeType) (ret SnapshotGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetNameAttributeType(arg *SnapshotGetNameAttributeType, val SnapshotGetNameRetType) { + *arg = &val +} + +type SnapshotGetNameArgType = string +type SnapshotGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type SnapshotGetSizeAttributeType = *int64 +type SnapshotGetSizeArgType = int64 +type SnapshotGetSizeRetType = int64 + +func getSnapshotGetSizeAttributeTypeOk(arg SnapshotGetSizeAttributeType) (ret SnapshotGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetSizeAttributeType(arg *SnapshotGetSizeAttributeType, val SnapshotGetSizeRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type SnapshotGetStatusAttributeType = *string + +func getSnapshotGetStatusAttributeTypeOk(arg SnapshotGetStatusAttributeType) (ret SnapshotGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetStatusAttributeType(arg *SnapshotGetStatusAttributeType, val SnapshotGetStatusRetType) { + *arg = &val +} + +type SnapshotGetStatusArgType = string +type SnapshotGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type SnapshotGetUpdatedAtAttributeType = *time.Time +type SnapshotGetUpdatedAtArgType = time.Time +type SnapshotGetUpdatedAtRetType = time.Time + +func getSnapshotGetUpdatedAtAttributeTypeOk(arg SnapshotGetUpdatedAtAttributeType) (ret SnapshotGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetUpdatedAtAttributeType(arg *SnapshotGetUpdatedAtAttributeType, val SnapshotGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type SnapshotGetVolumeIdAttributeType = *string + +func getSnapshotGetVolumeIdAttributeTypeOk(arg SnapshotGetVolumeIdAttributeType) (ret SnapshotGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotGetVolumeIdAttributeType(arg *SnapshotGetVolumeIdAttributeType, val SnapshotGetVolumeIdRetType) { + *arg = &val +} + +type SnapshotGetVolumeIdArgType = string +type SnapshotGetVolumeIdRetType = string + +// Snapshot Object that represents a snapshot. +type Snapshot struct { + // Date-time when resource was created. + CreatedAt SnapshotGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id SnapshotGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels SnapshotGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name SnapshotGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size SnapshotGetSizeAttributeType `json:"size,omitempty"` + // The status of a snapshot object. Possible values: `AVAILABLE`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. + Status SnapshotGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt SnapshotGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + // REQUIRED + VolumeId SnapshotGetVolumeIdAttributeType `json:"volumeId" required:"true"` +} + +type _Snapshot Snapshot + +// NewSnapshot instantiates a new Snapshot object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSnapshot(volumeId SnapshotGetVolumeIdArgType) *Snapshot { + this := Snapshot{} + setSnapshotGetVolumeIdAttributeType(&this.VolumeId, volumeId) + return &this +} + +// NewSnapshotWithDefaults instantiates a new Snapshot object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSnapshotWithDefaults() *Snapshot { + this := Snapshot{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Snapshot) GetCreatedAt() (res SnapshotGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetCreatedAtOk() (ret SnapshotGetCreatedAtRetType, ok bool) { + return getSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Snapshot) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Snapshot) SetCreatedAt(v SnapshotGetCreatedAtRetType) { + setSnapshotGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Snapshot) GetId() (res SnapshotGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetIdOk() (ret SnapshotGetIdRetType, ok bool) { + return getSnapshotGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Snapshot) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Snapshot) SetId(v SnapshotGetIdRetType) { + setSnapshotGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Snapshot) GetLabels() (res SnapshotGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetLabelsOk() (ret SnapshotGetLabelsRetType, ok bool) { + return getSnapshotGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Snapshot) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Snapshot) SetLabels(v SnapshotGetLabelsRetType) { + setSnapshotGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Snapshot) GetName() (res SnapshotGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetNameOk() (ret SnapshotGetNameRetType, ok bool) { + return getSnapshotGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Snapshot) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Snapshot) SetName(v SnapshotGetNameRetType) { + setSnapshotGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Snapshot) GetSize() (res SnapshotGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetSizeOk() (ret SnapshotGetSizeRetType, ok bool) { + return getSnapshotGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Snapshot) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Snapshot) SetSize(v SnapshotGetSizeRetType) { + setSnapshotGetSizeAttributeType(&o.Size, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Snapshot) GetStatus() (res SnapshotGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetStatusOk() (ret SnapshotGetStatusRetType, ok bool) { + return getSnapshotGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Snapshot) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Snapshot) SetStatus(v SnapshotGetStatusRetType) { + setSnapshotGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Snapshot) GetUpdatedAt() (res SnapshotGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Snapshot) GetUpdatedAtOk() (ret SnapshotGetUpdatedAtRetType, ok bool) { + return getSnapshotGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Snapshot) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Snapshot) SetUpdatedAt(v SnapshotGetUpdatedAtRetType) { + setSnapshotGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value +func (o *Snapshot) GetVolumeId() (ret SnapshotGetVolumeIdRetType) { + ret, _ = o.GetVolumeIdOk() + return ret +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value +// and a boolean to check if the value has been set. +func (o *Snapshot) GetVolumeIdOk() (ret SnapshotGetVolumeIdRetType, ok bool) { + return getSnapshotGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// SetVolumeId sets field value +func (o *Snapshot) SetVolumeId(v SnapshotGetVolumeIdRetType) { + setSnapshotGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o Snapshot) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSnapshotGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getSnapshotGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getSnapshotGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getSnapshotGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getSnapshotGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getSnapshotGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getSnapshotGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getSnapshotGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableSnapshot struct { + value *Snapshot + isSet bool +} + +func (v NullableSnapshot) Get() *Snapshot { + return v.value +} + +func (v *NullableSnapshot) Set(val *Snapshot) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshot) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshot) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshot(val *Snapshot) *NullableSnapshot { + return &NullableSnapshot{value: val, isSet: true} +} + +func (v NullableSnapshot) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshot) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_snapshot_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_snapshot_list_response.go new file mode 100644 index 00000000..53fa85e0 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_snapshot_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the SnapshotListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotListResponse{} + +/* + types and functions for items +*/ + +// isArray +type SnapshotListResponseGetItemsAttributeType = *[]Snapshot +type SnapshotListResponseGetItemsArgType = []Snapshot +type SnapshotListResponseGetItemsRetType = []Snapshot + +func getSnapshotListResponseGetItemsAttributeTypeOk(arg SnapshotListResponseGetItemsAttributeType) (ret SnapshotListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setSnapshotListResponseGetItemsAttributeType(arg *SnapshotListResponseGetItemsAttributeType, val SnapshotListResponseGetItemsRetType) { + *arg = &val +} + +// SnapshotListResponse Snapshot list response. +type SnapshotListResponse struct { + // A list containing snapshot objects. + // REQUIRED + Items SnapshotListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _SnapshotListResponse SnapshotListResponse + +// NewSnapshotListResponse instantiates a new SnapshotListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSnapshotListResponse(items SnapshotListResponseGetItemsArgType) *SnapshotListResponse { + this := SnapshotListResponse{} + setSnapshotListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewSnapshotListResponseWithDefaults instantiates a new SnapshotListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSnapshotListResponseWithDefaults() *SnapshotListResponse { + this := SnapshotListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *SnapshotListResponse) GetItems() (ret SnapshotListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *SnapshotListResponse) GetItemsOk() (ret SnapshotListResponseGetItemsRetType, ok bool) { + return getSnapshotListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *SnapshotListResponse) SetItems(v SnapshotListResponseGetItemsRetType) { + setSnapshotListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o SnapshotListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getSnapshotListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableSnapshotListResponse struct { + value *SnapshotListResponse + isSet bool +} + +func (v NullableSnapshotListResponse) Get() *SnapshotListResponse { + return v.value +} + +func (v *NullableSnapshotListResponse) Set(val *SnapshotListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableSnapshotListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableSnapshotListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSnapshotListResponse(val *SnapshotListResponse) *NullableSnapshotListResponse { + return &NullableSnapshotListResponse{value: val, isSet: true} +} + +func (v NullableSnapshotListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSnapshotListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_static_area_id.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_static_area_id.go new file mode 100644 index 00000000..9960b3d3 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_static_area_id.go @@ -0,0 +1,115 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "fmt" +) + +// StaticAreaID The identifier (ID) of a static area. +type StaticAreaID string + +// List of StaticAreaID +const ( + STATICAREAID_PUBLIC StaticAreaID = "PUBLIC" + STATICAREAID_SCHWARZ StaticAreaID = "SCHWARZ" +) + +// All allowed values of StaticAreaID enum +var AllowedStaticAreaIDEnumValues = []StaticAreaID{ + "PUBLIC", + "SCHWARZ", +} + +func (v *StaticAreaID) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := StaticAreaID(value) + for _, existing := range AllowedStaticAreaIDEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid StaticAreaID", value) +} + +// NewStaticAreaIDFromValue returns a pointer to a valid StaticAreaID +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewStaticAreaIDFromValue(v string) (*StaticAreaID, error) { + ev := StaticAreaID(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for StaticAreaID: valid values are %v", v, AllowedStaticAreaIDEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v StaticAreaID) IsValid() bool { + for _, existing := range AllowedStaticAreaIDEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to StaticAreaID value +func (v StaticAreaID) Ptr() *StaticAreaID { + return &v +} + +type NullableStaticAreaID struct { + value *StaticAreaID + isSet bool +} + +func (v NullableStaticAreaID) Get() *StaticAreaID { + return v.value +} + +func (v *NullableStaticAreaID) Set(val *StaticAreaID) { + v.value = val + v.isSet = true +} + +func (v NullableStaticAreaID) IsSet() bool { + return v.isSet +} + +func (v *NullableStaticAreaID) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStaticAreaID(val *StaticAreaID) *NullableStaticAreaID { + return &NullableStaticAreaID{value: val, isSet: true} +} + +func (v NullableStaticAreaID) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStaticAreaID) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_area_address_family.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_area_address_family.go new file mode 100644 index 00000000..70fe523b --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_area_address_family.go @@ -0,0 +1,127 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateAreaAddressFamily type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAreaAddressFamily{} + +/* + types and functions for ipv4 +*/ + +// isModel +type UpdateAreaAddressFamilyGetIpv4AttributeType = *UpdateAreaIPv4 +type UpdateAreaAddressFamilyGetIpv4ArgType = UpdateAreaIPv4 +type UpdateAreaAddressFamilyGetIpv4RetType = UpdateAreaIPv4 + +func getUpdateAreaAddressFamilyGetIpv4AttributeTypeOk(arg UpdateAreaAddressFamilyGetIpv4AttributeType) (ret UpdateAreaAddressFamilyGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAreaAddressFamilyGetIpv4AttributeType(arg *UpdateAreaAddressFamilyGetIpv4AttributeType, val UpdateAreaAddressFamilyGetIpv4RetType) { + *arg = &val +} + +// UpdateAreaAddressFamily The addressFamily object for a area update request. +type UpdateAreaAddressFamily struct { + Ipv4 UpdateAreaAddressFamilyGetIpv4AttributeType `json:"ipv4,omitempty"` +} + +// NewUpdateAreaAddressFamily instantiates a new UpdateAreaAddressFamily object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateAreaAddressFamily() *UpdateAreaAddressFamily { + this := UpdateAreaAddressFamily{} + return &this +} + +// NewUpdateAreaAddressFamilyWithDefaults instantiates a new UpdateAreaAddressFamily object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateAreaAddressFamilyWithDefaults() *UpdateAreaAddressFamily { + this := UpdateAreaAddressFamily{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *UpdateAreaAddressFamily) GetIpv4() (res UpdateAreaAddressFamilyGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAreaAddressFamily) GetIpv4Ok() (ret UpdateAreaAddressFamilyGetIpv4RetType, ok bool) { + return getUpdateAreaAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *UpdateAreaAddressFamily) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given UpdateAreaIPv4 and assigns it to the Ipv4 field. +func (o *UpdateAreaAddressFamily) SetIpv4(v UpdateAreaAddressFamilyGetIpv4RetType) { + setUpdateAreaAddressFamilyGetIpv4AttributeType(&o.Ipv4, v) +} + +func (o UpdateAreaAddressFamily) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAreaAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + return toSerialize, nil +} + +type NullableUpdateAreaAddressFamily struct { + value *UpdateAreaAddressFamily + isSet bool +} + +func (v NullableUpdateAreaAddressFamily) Get() *UpdateAreaAddressFamily { + return v.value +} + +func (v *NullableUpdateAreaAddressFamily) Set(val *UpdateAreaAddressFamily) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAreaAddressFamily) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAreaAddressFamily) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAreaAddressFamily(val *UpdateAreaAddressFamily) *NullableUpdateAreaAddressFamily { + return &NullableUpdateAreaAddressFamily{value: val, isSet: true} +} + +func (v NullableUpdateAreaAddressFamily) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAreaAddressFamily) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_area_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_area_ipv4.go new file mode 100644 index 00000000..bc3d83e2 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_area_ipv4.go @@ -0,0 +1,271 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateAreaIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAreaIPv4{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type UpdateAreaIPv4GetDefaultNameserversAttributeType = *[]string +type UpdateAreaIPv4GetDefaultNameserversArgType = []string +type UpdateAreaIPv4GetDefaultNameserversRetType = []string + +func getUpdateAreaIPv4GetDefaultNameserversAttributeTypeOk(arg UpdateAreaIPv4GetDefaultNameserversAttributeType) (ret UpdateAreaIPv4GetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAreaIPv4GetDefaultNameserversAttributeType(arg *UpdateAreaIPv4GetDefaultNameserversAttributeType, val UpdateAreaIPv4GetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for defaultPrefixLen +*/ + +// isInteger +type UpdateAreaIPv4GetDefaultPrefixLenAttributeType = *int64 +type UpdateAreaIPv4GetDefaultPrefixLenArgType = int64 +type UpdateAreaIPv4GetDefaultPrefixLenRetType = int64 + +func getUpdateAreaIPv4GetDefaultPrefixLenAttributeTypeOk(arg UpdateAreaIPv4GetDefaultPrefixLenAttributeType) (ret UpdateAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAreaIPv4GetDefaultPrefixLenAttributeType(arg *UpdateAreaIPv4GetDefaultPrefixLenAttributeType, val UpdateAreaIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isInteger +type UpdateAreaIPv4GetMaxPrefixLenAttributeType = *int64 +type UpdateAreaIPv4GetMaxPrefixLenArgType = int64 +type UpdateAreaIPv4GetMaxPrefixLenRetType = int64 + +func getUpdateAreaIPv4GetMaxPrefixLenAttributeTypeOk(arg UpdateAreaIPv4GetMaxPrefixLenAttributeType) (ret UpdateAreaIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAreaIPv4GetMaxPrefixLenAttributeType(arg *UpdateAreaIPv4GetMaxPrefixLenAttributeType, val UpdateAreaIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isInteger +type UpdateAreaIPv4GetMinPrefixLenAttributeType = *int64 +type UpdateAreaIPv4GetMinPrefixLenArgType = int64 +type UpdateAreaIPv4GetMinPrefixLenRetType = int64 + +func getUpdateAreaIPv4GetMinPrefixLenAttributeTypeOk(arg UpdateAreaIPv4GetMinPrefixLenAttributeType) (ret UpdateAreaIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAreaIPv4GetMinPrefixLenAttributeType(arg *UpdateAreaIPv4GetMinPrefixLenAttributeType, val UpdateAreaIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +// UpdateAreaIPv4 The update object for a IPv4 network area. +type UpdateAreaIPv4 struct { + DefaultNameservers UpdateAreaIPv4GetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // The default prefix length for networks in the network area. + DefaultPrefixLen UpdateAreaIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen,omitempty"` + // The maximal prefix length for networks in the network area. + MaxPrefixLen UpdateAreaIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen,omitempty"` + // The minimal prefix length for networks in the network area. + MinPrefixLen UpdateAreaIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen,omitempty"` +} + +// NewUpdateAreaIPv4 instantiates a new UpdateAreaIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateAreaIPv4() *UpdateAreaIPv4 { + this := UpdateAreaIPv4{} + return &this +} + +// NewUpdateAreaIPv4WithDefaults instantiates a new UpdateAreaIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateAreaIPv4WithDefaults() *UpdateAreaIPv4 { + this := UpdateAreaIPv4{} + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *UpdateAreaIPv4) GetDefaultNameservers() (res UpdateAreaIPv4GetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAreaIPv4) GetDefaultNameserversOk() (ret UpdateAreaIPv4GetDefaultNameserversRetType, ok bool) { + return getUpdateAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *UpdateAreaIPv4) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *UpdateAreaIPv4) SetDefaultNameservers(v UpdateAreaIPv4GetDefaultNameserversRetType) { + setUpdateAreaIPv4GetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value if set, zero value otherwise. +func (o *UpdateAreaIPv4) GetDefaultPrefixLen() (res UpdateAreaIPv4GetDefaultPrefixLenRetType) { + res, _ = o.GetDefaultPrefixLenOk() + return +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAreaIPv4) GetDefaultPrefixLenOk() (ret UpdateAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + return getUpdateAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// HasDefaultPrefixLen returns a boolean if a field has been set. +func (o *UpdateAreaIPv4) HasDefaultPrefixLen() bool { + _, ok := o.GetDefaultPrefixLenOk() + return ok +} + +// SetDefaultPrefixLen gets a reference to the given int64 and assigns it to the DefaultPrefixLen field. +func (o *UpdateAreaIPv4) SetDefaultPrefixLen(v UpdateAreaIPv4GetDefaultPrefixLenRetType) { + setUpdateAreaIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value if set, zero value otherwise. +func (o *UpdateAreaIPv4) GetMaxPrefixLen() (res UpdateAreaIPv4GetMaxPrefixLenRetType) { + res, _ = o.GetMaxPrefixLenOk() + return +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAreaIPv4) GetMaxPrefixLenOk() (ret UpdateAreaIPv4GetMaxPrefixLenRetType, ok bool) { + return getUpdateAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// HasMaxPrefixLen returns a boolean if a field has been set. +func (o *UpdateAreaIPv4) HasMaxPrefixLen() bool { + _, ok := o.GetMaxPrefixLenOk() + return ok +} + +// SetMaxPrefixLen gets a reference to the given int64 and assigns it to the MaxPrefixLen field. +func (o *UpdateAreaIPv4) SetMaxPrefixLen(v UpdateAreaIPv4GetMaxPrefixLenRetType) { + setUpdateAreaIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value if set, zero value otherwise. +func (o *UpdateAreaIPv4) GetMinPrefixLen() (res UpdateAreaIPv4GetMinPrefixLenRetType) { + res, _ = o.GetMinPrefixLenOk() + return +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAreaIPv4) GetMinPrefixLenOk() (ret UpdateAreaIPv4GetMinPrefixLenRetType, ok bool) { + return getUpdateAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// HasMinPrefixLen returns a boolean if a field has been set. +func (o *UpdateAreaIPv4) HasMinPrefixLen() bool { + _, ok := o.GetMinPrefixLenOk() + return ok +} + +// SetMinPrefixLen gets a reference to the given int64 and assigns it to the MinPrefixLen field. +func (o *UpdateAreaIPv4) SetMinPrefixLen(v UpdateAreaIPv4GetMinPrefixLenRetType) { + setUpdateAreaIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +func (o UpdateAreaIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getUpdateAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getUpdateAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getUpdateAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + return toSerialize, nil +} + +type NullableUpdateAreaIPv4 struct { + value *UpdateAreaIPv4 + isSet bool +} + +func (v NullableUpdateAreaIPv4) Get() *UpdateAreaIPv4 { + return v.value +} + +func (v *NullableUpdateAreaIPv4) Set(val *UpdateAreaIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAreaIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAreaIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAreaIPv4(val *UpdateAreaIPv4) *NullableUpdateAreaIPv4 { + return &NullableUpdateAreaIPv4{value: val, isSet: true} +} + +func (v NullableUpdateAreaIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAreaIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_attached_volume_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_attached_volume_payload.go new file mode 100644 index 00000000..5254e10a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_attached_volume_payload.go @@ -0,0 +1,226 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateAttachedVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAttachedVolumePayload{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType = *bool +type UpdateAttachedVolumePayloadgetDeleteOnTerminationArgType = bool +type UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType = bool + +func getUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeTypeOk(arg UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType) (ret UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType(arg *UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType, val UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for serverId +*/ + +// isNotNullableString +type UpdateAttachedVolumePayloadGetServerIdAttributeType = *string + +func getUpdateAttachedVolumePayloadGetServerIdAttributeTypeOk(arg UpdateAttachedVolumePayloadGetServerIdAttributeType) (ret UpdateAttachedVolumePayloadGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAttachedVolumePayloadGetServerIdAttributeType(arg *UpdateAttachedVolumePayloadGetServerIdAttributeType, val UpdateAttachedVolumePayloadGetServerIdRetType) { + *arg = &val +} + +type UpdateAttachedVolumePayloadGetServerIdArgType = string +type UpdateAttachedVolumePayloadGetServerIdRetType = string + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type UpdateAttachedVolumePayloadGetVolumeIdAttributeType = *string + +func getUpdateAttachedVolumePayloadGetVolumeIdAttributeTypeOk(arg UpdateAttachedVolumePayloadGetVolumeIdAttributeType) (ret UpdateAttachedVolumePayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAttachedVolumePayloadGetVolumeIdAttributeType(arg *UpdateAttachedVolumePayloadGetVolumeIdAttributeType, val UpdateAttachedVolumePayloadGetVolumeIdRetType) { + *arg = &val +} + +type UpdateAttachedVolumePayloadGetVolumeIdArgType = string +type UpdateAttachedVolumePayloadGetVolumeIdRetType = string + +// UpdateAttachedVolumePayload Object that represents a Volume attachment to a server. +type UpdateAttachedVolumePayload struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination UpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId UpdateAttachedVolumePayloadGetServerIdAttributeType `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId UpdateAttachedVolumePayloadGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewUpdateAttachedVolumePayload instantiates a new UpdateAttachedVolumePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateAttachedVolumePayload() *UpdateAttachedVolumePayload { + this := UpdateAttachedVolumePayload{} + return &this +} + +// NewUpdateAttachedVolumePayloadWithDefaults instantiates a new UpdateAttachedVolumePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateAttachedVolumePayloadWithDefaults() *UpdateAttachedVolumePayload { + this := UpdateAttachedVolumePayload{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetDeleteOnTermination() (res UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetDeleteOnTerminationOk() (ret UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType, ok bool) { + return getUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *UpdateAttachedVolumePayload) SetDeleteOnTermination(v UpdateAttachedVolumePayloadgetDeleteOnTerminationRetType) { + setUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetServerId() (res UpdateAttachedVolumePayloadGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetServerIdOk() (ret UpdateAttachedVolumePayloadGetServerIdRetType, ok bool) { + return getUpdateAttachedVolumePayloadGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *UpdateAttachedVolumePayload) SetServerId(v UpdateAttachedVolumePayloadGetServerIdRetType) { + setUpdateAttachedVolumePayloadGetServerIdAttributeType(&o.ServerId, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *UpdateAttachedVolumePayload) GetVolumeId() (res UpdateAttachedVolumePayloadGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAttachedVolumePayload) GetVolumeIdOk() (ret UpdateAttachedVolumePayloadGetVolumeIdRetType, ok bool) { + return getUpdateAttachedVolumePayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *UpdateAttachedVolumePayload) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *UpdateAttachedVolumePayload) SetVolumeId(v UpdateAttachedVolumePayloadGetVolumeIdRetType) { + setUpdateAttachedVolumePayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o UpdateAttachedVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAttachedVolumePayloadgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getUpdateAttachedVolumePayloadGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getUpdateAttachedVolumePayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableUpdateAttachedVolumePayload struct { + value *UpdateAttachedVolumePayload + isSet bool +} + +func (v NullableUpdateAttachedVolumePayload) Get() *UpdateAttachedVolumePayload { + return v.value +} + +func (v *NullableUpdateAttachedVolumePayload) Set(val *UpdateAttachedVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAttachedVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAttachedVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAttachedVolumePayload(val *UpdateAttachedVolumePayload) *NullableUpdateAttachedVolumePayload { + return &NullableUpdateAttachedVolumePayload{value: val, isSet: true} +} + +func (v NullableUpdateAttachedVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAttachedVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_backup_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_backup_payload.go new file mode 100644 index 00000000..8d62403f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_backup_payload.go @@ -0,0 +1,567 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the UpdateBackupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateBackupPayload{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type UpdateBackupPayloadGetAvailabilityZoneAttributeType = *string + +func getUpdateBackupPayloadGetAvailabilityZoneAttributeTypeOk(arg UpdateBackupPayloadGetAvailabilityZoneAttributeType) (ret UpdateBackupPayloadGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetAvailabilityZoneAttributeType(arg *UpdateBackupPayloadGetAvailabilityZoneAttributeType, val UpdateBackupPayloadGetAvailabilityZoneRetType) { + *arg = &val +} + +type UpdateBackupPayloadGetAvailabilityZoneArgType = string +type UpdateBackupPayloadGetAvailabilityZoneRetType = string + +/* + types and functions for createdAt +*/ + +// isDateTime +type UpdateBackupPayloadGetCreatedAtAttributeType = *time.Time +type UpdateBackupPayloadGetCreatedAtArgType = time.Time +type UpdateBackupPayloadGetCreatedAtRetType = time.Time + +func getUpdateBackupPayloadGetCreatedAtAttributeTypeOk(arg UpdateBackupPayloadGetCreatedAtAttributeType) (ret UpdateBackupPayloadGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetCreatedAtAttributeType(arg *UpdateBackupPayloadGetCreatedAtAttributeType, val UpdateBackupPayloadGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type UpdateBackupPayloadGetIdAttributeType = *string + +func getUpdateBackupPayloadGetIdAttributeTypeOk(arg UpdateBackupPayloadGetIdAttributeType) (ret UpdateBackupPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetIdAttributeType(arg *UpdateBackupPayloadGetIdAttributeType, val UpdateBackupPayloadGetIdRetType) { + *arg = &val +} + +type UpdateBackupPayloadGetIdArgType = string +type UpdateBackupPayloadGetIdRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateBackupPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateBackupPayloadGetLabelsArgType = map[string]interface{} +type UpdateBackupPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateBackupPayloadGetLabelsAttributeTypeOk(arg UpdateBackupPayloadGetLabelsAttributeType) (ret UpdateBackupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetLabelsAttributeType(arg *UpdateBackupPayloadGetLabelsAttributeType, val UpdateBackupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateBackupPayloadGetNameAttributeType = *string + +func getUpdateBackupPayloadGetNameAttributeTypeOk(arg UpdateBackupPayloadGetNameAttributeType) (ret UpdateBackupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetNameAttributeType(arg *UpdateBackupPayloadGetNameAttributeType, val UpdateBackupPayloadGetNameRetType) { + *arg = &val +} + +type UpdateBackupPayloadGetNameArgType = string +type UpdateBackupPayloadGetNameRetType = string + +/* + types and functions for size +*/ + +// isLong +type UpdateBackupPayloadGetSizeAttributeType = *int64 +type UpdateBackupPayloadGetSizeArgType = int64 +type UpdateBackupPayloadGetSizeRetType = int64 + +func getUpdateBackupPayloadGetSizeAttributeTypeOk(arg UpdateBackupPayloadGetSizeAttributeType) (ret UpdateBackupPayloadGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetSizeAttributeType(arg *UpdateBackupPayloadGetSizeAttributeType, val UpdateBackupPayloadGetSizeRetType) { + *arg = &val +} + +/* + types and functions for snapshotId +*/ + +// isNotNullableString +type UpdateBackupPayloadGetSnapshotIdAttributeType = *string + +func getUpdateBackupPayloadGetSnapshotIdAttributeTypeOk(arg UpdateBackupPayloadGetSnapshotIdAttributeType) (ret UpdateBackupPayloadGetSnapshotIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetSnapshotIdAttributeType(arg *UpdateBackupPayloadGetSnapshotIdAttributeType, val UpdateBackupPayloadGetSnapshotIdRetType) { + *arg = &val +} + +type UpdateBackupPayloadGetSnapshotIdArgType = string +type UpdateBackupPayloadGetSnapshotIdRetType = string + +/* + types and functions for status +*/ + +// isNotNullableString +type UpdateBackupPayloadGetStatusAttributeType = *string + +func getUpdateBackupPayloadGetStatusAttributeTypeOk(arg UpdateBackupPayloadGetStatusAttributeType) (ret UpdateBackupPayloadGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetStatusAttributeType(arg *UpdateBackupPayloadGetStatusAttributeType, val UpdateBackupPayloadGetStatusRetType) { + *arg = &val +} + +type UpdateBackupPayloadGetStatusArgType = string +type UpdateBackupPayloadGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type UpdateBackupPayloadGetUpdatedAtAttributeType = *time.Time +type UpdateBackupPayloadGetUpdatedAtArgType = time.Time +type UpdateBackupPayloadGetUpdatedAtRetType = time.Time + +func getUpdateBackupPayloadGetUpdatedAtAttributeTypeOk(arg UpdateBackupPayloadGetUpdatedAtAttributeType) (ret UpdateBackupPayloadGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetUpdatedAtAttributeType(arg *UpdateBackupPayloadGetUpdatedAtAttributeType, val UpdateBackupPayloadGetUpdatedAtRetType) { + *arg = &val +} + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type UpdateBackupPayloadGetVolumeIdAttributeType = *string + +func getUpdateBackupPayloadGetVolumeIdAttributeTypeOk(arg UpdateBackupPayloadGetVolumeIdAttributeType) (ret UpdateBackupPayloadGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateBackupPayloadGetVolumeIdAttributeType(arg *UpdateBackupPayloadGetVolumeIdAttributeType, val UpdateBackupPayloadGetVolumeIdRetType) { + *arg = &val +} + +type UpdateBackupPayloadGetVolumeIdArgType = string +type UpdateBackupPayloadGetVolumeIdRetType = string + +// UpdateBackupPayload Object that represents a backup. +type UpdateBackupPayload struct { + // Object that represents an availability zone. + AvailabilityZone UpdateBackupPayloadGetAvailabilityZoneAttributeType `json:"availabilityZone,omitempty"` + // Date-time when resource was created. + CreatedAt UpdateBackupPayloadGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Universally Unique Identifier (UUID). + Id UpdateBackupPayloadGetIdAttributeType `json:"id,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateBackupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateBackupPayloadGetNameAttributeType `json:"name,omitempty"` + // Size in Gigabyte. + Size UpdateBackupPayloadGetSizeAttributeType `json:"size,omitempty"` + // Universally Unique Identifier (UUID). + SnapshotId UpdateBackupPayloadGetSnapshotIdAttributeType `json:"snapshotId,omitempty"` + // The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`. + Status UpdateBackupPayloadGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt UpdateBackupPayloadGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId UpdateBackupPayloadGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewUpdateBackupPayload instantiates a new UpdateBackupPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateBackupPayload() *UpdateBackupPayload { + this := UpdateBackupPayload{} + return &this +} + +// NewUpdateBackupPayloadWithDefaults instantiates a new UpdateBackupPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateBackupPayloadWithDefaults() *UpdateBackupPayload { + this := UpdateBackupPayload{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetAvailabilityZone() (res UpdateBackupPayloadGetAvailabilityZoneRetType) { + res, _ = o.GetAvailabilityZoneOk() + return +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetAvailabilityZoneOk() (ret UpdateBackupPayloadGetAvailabilityZoneRetType, ok bool) { + return getUpdateBackupPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasAvailabilityZone() bool { + _, ok := o.GetAvailabilityZoneOk() + return ok +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *UpdateBackupPayload) SetAvailabilityZone(v UpdateBackupPayloadGetAvailabilityZoneRetType) { + setUpdateBackupPayloadGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetCreatedAt() (res UpdateBackupPayloadGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetCreatedAtOk() (ret UpdateBackupPayloadGetCreatedAtRetType, ok bool) { + return getUpdateBackupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *UpdateBackupPayload) SetCreatedAt(v UpdateBackupPayloadGetCreatedAtRetType) { + setUpdateBackupPayloadGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetId() (res UpdateBackupPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetIdOk() (ret UpdateBackupPayloadGetIdRetType, ok bool) { + return getUpdateBackupPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdateBackupPayload) SetId(v UpdateBackupPayloadGetIdRetType) { + setUpdateBackupPayloadGetIdAttributeType(&o.Id, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetLabels() (res UpdateBackupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetLabelsOk() (ret UpdateBackupPayloadGetLabelsRetType, ok bool) { + return getUpdateBackupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateBackupPayload) SetLabels(v UpdateBackupPayloadGetLabelsRetType) { + setUpdateBackupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetName() (res UpdateBackupPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetNameOk() (ret UpdateBackupPayloadGetNameRetType, ok bool) { + return getUpdateBackupPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateBackupPayload) SetName(v UpdateBackupPayloadGetNameRetType) { + setUpdateBackupPayloadGetNameAttributeType(&o.Name, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetSize() (res UpdateBackupPayloadGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetSizeOk() (ret UpdateBackupPayloadGetSizeRetType, ok bool) { + return getUpdateBackupPayloadGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *UpdateBackupPayload) SetSize(v UpdateBackupPayloadGetSizeRetType) { + setUpdateBackupPayloadGetSizeAttributeType(&o.Size, v) +} + +// GetSnapshotId returns the SnapshotId field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetSnapshotId() (res UpdateBackupPayloadGetSnapshotIdRetType) { + res, _ = o.GetSnapshotIdOk() + return +} + +// GetSnapshotIdOk returns a tuple with the SnapshotId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetSnapshotIdOk() (ret UpdateBackupPayloadGetSnapshotIdRetType, ok bool) { + return getUpdateBackupPayloadGetSnapshotIdAttributeTypeOk(o.SnapshotId) +} + +// HasSnapshotId returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasSnapshotId() bool { + _, ok := o.GetSnapshotIdOk() + return ok +} + +// SetSnapshotId gets a reference to the given string and assigns it to the SnapshotId field. +func (o *UpdateBackupPayload) SetSnapshotId(v UpdateBackupPayloadGetSnapshotIdRetType) { + setUpdateBackupPayloadGetSnapshotIdAttributeType(&o.SnapshotId, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetStatus() (res UpdateBackupPayloadGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetStatusOk() (ret UpdateBackupPayloadGetStatusRetType, ok bool) { + return getUpdateBackupPayloadGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *UpdateBackupPayload) SetStatus(v UpdateBackupPayloadGetStatusRetType) { + setUpdateBackupPayloadGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetUpdatedAt() (res UpdateBackupPayloadGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetUpdatedAtOk() (ret UpdateBackupPayloadGetUpdatedAtRetType, ok bool) { + return getUpdateBackupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *UpdateBackupPayload) SetUpdatedAt(v UpdateBackupPayloadGetUpdatedAtRetType) { + setUpdateBackupPayloadGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *UpdateBackupPayload) GetVolumeId() (res UpdateBackupPayloadGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateBackupPayload) GetVolumeIdOk() (ret UpdateBackupPayloadGetVolumeIdRetType, ok bool) { + return getUpdateBackupPayloadGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *UpdateBackupPayload) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *UpdateBackupPayload) SetVolumeId(v UpdateBackupPayloadGetVolumeIdRetType) { + setUpdateBackupPayloadGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o UpdateBackupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateBackupPayloadGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getUpdateBackupPayloadGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getUpdateBackupPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getUpdateBackupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateBackupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateBackupPayloadGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getUpdateBackupPayloadGetSnapshotIdAttributeTypeOk(o.SnapshotId); ok { + toSerialize["SnapshotId"] = val + } + if val, ok := getUpdateBackupPayloadGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getUpdateBackupPayloadGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + if val, ok := getUpdateBackupPayloadGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableUpdateBackupPayload struct { + value *UpdateBackupPayload + isSet bool +} + +func (v NullableUpdateBackupPayload) Get() *UpdateBackupPayload { + return v.value +} + +func (v *NullableUpdateBackupPayload) Set(val *UpdateBackupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateBackupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateBackupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateBackupPayload(val *UpdateBackupPayload) *NullableUpdateBackupPayload { + return &NullableUpdateBackupPayload{value: val, isSet: true} +} + +func (v NullableUpdateBackupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateBackupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_image_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_image_payload.go new file mode 100644 index 00000000..48203823 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_image_payload.go @@ -0,0 +1,464 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateImagePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImagePayload{} + +/* + types and functions for agent +*/ + +// isModel +type UpdateImagePayloadGetAgentAttributeType = *ImageAgent +type UpdateImagePayloadGetAgentArgType = ImageAgent +type UpdateImagePayloadGetAgentRetType = ImageAgent + +func getUpdateImagePayloadGetAgentAttributeTypeOk(arg UpdateImagePayloadGetAgentAttributeType) (ret UpdateImagePayloadGetAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetAgentAttributeType(arg *UpdateImagePayloadGetAgentAttributeType, val UpdateImagePayloadGetAgentRetType) { + *arg = &val +} + +/* + types and functions for config +*/ + +// isModel +type UpdateImagePayloadGetConfigAttributeType = *ImageConfig +type UpdateImagePayloadGetConfigArgType = ImageConfig +type UpdateImagePayloadGetConfigRetType = ImageConfig + +func getUpdateImagePayloadGetConfigAttributeTypeOk(arg UpdateImagePayloadGetConfigAttributeType) (ret UpdateImagePayloadGetConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetConfigAttributeType(arg *UpdateImagePayloadGetConfigAttributeType, val UpdateImagePayloadGetConfigRetType) { + *arg = &val +} + +/* + types and functions for diskFormat +*/ + +// isNotNullableString +type UpdateImagePayloadGetDiskFormatAttributeType = *string + +func getUpdateImagePayloadGetDiskFormatAttributeTypeOk(arg UpdateImagePayloadGetDiskFormatAttributeType) (ret UpdateImagePayloadGetDiskFormatRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetDiskFormatAttributeType(arg *UpdateImagePayloadGetDiskFormatAttributeType, val UpdateImagePayloadGetDiskFormatRetType) { + *arg = &val +} + +type UpdateImagePayloadGetDiskFormatArgType = string +type UpdateImagePayloadGetDiskFormatRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateImagePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateImagePayloadGetLabelsArgType = map[string]interface{} +type UpdateImagePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateImagePayloadGetLabelsAttributeTypeOk(arg UpdateImagePayloadGetLabelsAttributeType) (ret UpdateImagePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetLabelsAttributeType(arg *UpdateImagePayloadGetLabelsAttributeType, val UpdateImagePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for minDiskSize +*/ + +// isLong +type UpdateImagePayloadGetMinDiskSizeAttributeType = *int64 +type UpdateImagePayloadGetMinDiskSizeArgType = int64 +type UpdateImagePayloadGetMinDiskSizeRetType = int64 + +func getUpdateImagePayloadGetMinDiskSizeAttributeTypeOk(arg UpdateImagePayloadGetMinDiskSizeAttributeType) (ret UpdateImagePayloadGetMinDiskSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetMinDiskSizeAttributeType(arg *UpdateImagePayloadGetMinDiskSizeAttributeType, val UpdateImagePayloadGetMinDiskSizeRetType) { + *arg = &val +} + +/* + types and functions for minRam +*/ + +// isLong +type UpdateImagePayloadGetMinRamAttributeType = *int64 +type UpdateImagePayloadGetMinRamArgType = int64 +type UpdateImagePayloadGetMinRamRetType = int64 + +func getUpdateImagePayloadGetMinRamAttributeTypeOk(arg UpdateImagePayloadGetMinRamAttributeType) (ret UpdateImagePayloadGetMinRamRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetMinRamAttributeType(arg *UpdateImagePayloadGetMinRamAttributeType, val UpdateImagePayloadGetMinRamRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateImagePayloadGetNameAttributeType = *string + +func getUpdateImagePayloadGetNameAttributeTypeOk(arg UpdateImagePayloadGetNameAttributeType) (ret UpdateImagePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadGetNameAttributeType(arg *UpdateImagePayloadGetNameAttributeType, val UpdateImagePayloadGetNameRetType) { + *arg = &val +} + +type UpdateImagePayloadGetNameArgType = string +type UpdateImagePayloadGetNameRetType = string + +/* + types and functions for protected +*/ + +// isBoolean +type UpdateImagePayloadgetProtectedAttributeType = *bool +type UpdateImagePayloadgetProtectedArgType = bool +type UpdateImagePayloadgetProtectedRetType = bool + +func getUpdateImagePayloadgetProtectedAttributeTypeOk(arg UpdateImagePayloadgetProtectedAttributeType) (ret UpdateImagePayloadgetProtectedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImagePayloadgetProtectedAttributeType(arg *UpdateImagePayloadgetProtectedAttributeType, val UpdateImagePayloadgetProtectedRetType) { + *arg = &val +} + +// UpdateImagePayload Object that represents an update request body of an Image. +type UpdateImagePayload struct { + Agent UpdateImagePayloadGetAgentAttributeType `json:"agent,omitempty"` + Config UpdateImagePayloadGetConfigAttributeType `json:"config,omitempty"` + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. + DiskFormat UpdateImagePayloadGetDiskFormatAttributeType `json:"diskFormat,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateImagePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Size in Gigabyte. + MinDiskSize UpdateImagePayloadGetMinDiskSizeAttributeType `json:"minDiskSize,omitempty"` + // Size in Megabyte. + MinRam UpdateImagePayloadGetMinRamAttributeType `json:"minRam,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateImagePayloadGetNameAttributeType `json:"name,omitempty"` + // When true the image is prevented from being deleted. + Protected UpdateImagePayloadgetProtectedAttributeType `json:"protected,omitempty"` +} + +// NewUpdateImagePayload instantiates a new UpdateImagePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateImagePayload() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// NewUpdateImagePayloadWithDefaults instantiates a new UpdateImagePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateImagePayloadWithDefaults() *UpdateImagePayload { + this := UpdateImagePayload{} + return &this +} + +// GetAgent returns the Agent field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetAgent() (res UpdateImagePayloadGetAgentRetType) { + res, _ = o.GetAgentOk() + return +} + +// GetAgentOk returns a tuple with the Agent field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetAgentOk() (ret UpdateImagePayloadGetAgentRetType, ok bool) { + return getUpdateImagePayloadGetAgentAttributeTypeOk(o.Agent) +} + +// HasAgent returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasAgent() bool { + _, ok := o.GetAgentOk() + return ok +} + +// SetAgent gets a reference to the given ImageAgent and assigns it to the Agent field. +func (o *UpdateImagePayload) SetAgent(v UpdateImagePayloadGetAgentRetType) { + setUpdateImagePayloadGetAgentAttributeType(&o.Agent, v) +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetConfig() (res UpdateImagePayloadGetConfigRetType) { + res, _ = o.GetConfigOk() + return +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetConfigOk() (ret UpdateImagePayloadGetConfigRetType, ok bool) { + return getUpdateImagePayloadGetConfigAttributeTypeOk(o.Config) +} + +// HasConfig returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasConfig() bool { + _, ok := o.GetConfigOk() + return ok +} + +// SetConfig gets a reference to the given ImageConfig and assigns it to the Config field. +func (o *UpdateImagePayload) SetConfig(v UpdateImagePayloadGetConfigRetType) { + setUpdateImagePayloadGetConfigAttributeType(&o.Config, v) +} + +// GetDiskFormat returns the DiskFormat field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetDiskFormat() (res UpdateImagePayloadGetDiskFormatRetType) { + res, _ = o.GetDiskFormatOk() + return +} + +// GetDiskFormatOk returns a tuple with the DiskFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetDiskFormatOk() (ret UpdateImagePayloadGetDiskFormatRetType, ok bool) { + return getUpdateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat) +} + +// HasDiskFormat returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasDiskFormat() bool { + _, ok := o.GetDiskFormatOk() + return ok +} + +// SetDiskFormat gets a reference to the given string and assigns it to the DiskFormat field. +func (o *UpdateImagePayload) SetDiskFormat(v UpdateImagePayloadGetDiskFormatRetType) { + setUpdateImagePayloadGetDiskFormatAttributeType(&o.DiskFormat, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetLabels() (res UpdateImagePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetLabelsOk() (ret UpdateImagePayloadGetLabelsRetType, ok bool) { + return getUpdateImagePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateImagePayload) SetLabels(v UpdateImagePayloadGetLabelsRetType) { + setUpdateImagePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMinDiskSize returns the MinDiskSize field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinDiskSize() (res UpdateImagePayloadGetMinDiskSizeRetType) { + res, _ = o.GetMinDiskSizeOk() + return +} + +// GetMinDiskSizeOk returns a tuple with the MinDiskSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinDiskSizeOk() (ret UpdateImagePayloadGetMinDiskSizeRetType, ok bool) { + return getUpdateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize) +} + +// HasMinDiskSize returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinDiskSize() bool { + _, ok := o.GetMinDiskSizeOk() + return ok +} + +// SetMinDiskSize gets a reference to the given int64 and assigns it to the MinDiskSize field. +func (o *UpdateImagePayload) SetMinDiskSize(v UpdateImagePayloadGetMinDiskSizeRetType) { + setUpdateImagePayloadGetMinDiskSizeAttributeType(&o.MinDiskSize, v) +} + +// GetMinRam returns the MinRam field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetMinRam() (res UpdateImagePayloadGetMinRamRetType) { + res, _ = o.GetMinRamOk() + return +} + +// GetMinRamOk returns a tuple with the MinRam field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetMinRamOk() (ret UpdateImagePayloadGetMinRamRetType, ok bool) { + return getUpdateImagePayloadGetMinRamAttributeTypeOk(o.MinRam) +} + +// HasMinRam returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasMinRam() bool { + _, ok := o.GetMinRamOk() + return ok +} + +// SetMinRam gets a reference to the given int64 and assigns it to the MinRam field. +func (o *UpdateImagePayload) SetMinRam(v UpdateImagePayloadGetMinRamRetType) { + setUpdateImagePayloadGetMinRamAttributeType(&o.MinRam, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetName() (res UpdateImagePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetNameOk() (ret UpdateImagePayloadGetNameRetType, ok bool) { + return getUpdateImagePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateImagePayload) SetName(v UpdateImagePayloadGetNameRetType) { + setUpdateImagePayloadGetNameAttributeType(&o.Name, v) +} + +// GetProtected returns the Protected field value if set, zero value otherwise. +func (o *UpdateImagePayload) GetProtected() (res UpdateImagePayloadgetProtectedRetType) { + res, _ = o.GetProtectedOk() + return +} + +// GetProtectedOk returns a tuple with the Protected field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImagePayload) GetProtectedOk() (ret UpdateImagePayloadgetProtectedRetType, ok bool) { + return getUpdateImagePayloadgetProtectedAttributeTypeOk(o.Protected) +} + +// HasProtected returns a boolean if a field has been set. +func (o *UpdateImagePayload) HasProtected() bool { + _, ok := o.GetProtectedOk() + return ok +} + +// SetProtected gets a reference to the given bool and assigns it to the Protected field. +func (o *UpdateImagePayload) SetProtected(v UpdateImagePayloadgetProtectedRetType) { + setUpdateImagePayloadgetProtectedAttributeType(&o.Protected, v) +} + +func (o UpdateImagePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateImagePayloadGetAgentAttributeTypeOk(o.Agent); ok { + toSerialize["Agent"] = val + } + if val, ok := getUpdateImagePayloadGetConfigAttributeTypeOk(o.Config); ok { + toSerialize["Config"] = val + } + if val, ok := getUpdateImagePayloadGetDiskFormatAttributeTypeOk(o.DiskFormat); ok { + toSerialize["DiskFormat"] = val + } + if val, ok := getUpdateImagePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateImagePayloadGetMinDiskSizeAttributeTypeOk(o.MinDiskSize); ok { + toSerialize["MinDiskSize"] = val + } + if val, ok := getUpdateImagePayloadGetMinRamAttributeTypeOk(o.MinRam); ok { + toSerialize["MinRam"] = val + } + if val, ok := getUpdateImagePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateImagePayloadgetProtectedAttributeTypeOk(o.Protected); ok { + toSerialize["Protected"] = val + } + return toSerialize, nil +} + +type NullableUpdateImagePayload struct { + value *UpdateImagePayload + isSet bool +} + +func (v NullableUpdateImagePayload) Get() *UpdateImagePayload { + return v.value +} + +func (v *NullableUpdateImagePayload) Set(val *UpdateImagePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateImagePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateImagePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateImagePayload(val *UpdateImagePayload) *NullableUpdateImagePayload { + return &NullableUpdateImagePayload{value: val, isSet: true} +} + +func (v NullableUpdateImagePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateImagePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_image_share_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_image_share_payload.go new file mode 100644 index 00000000..50947eb1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_image_share_payload.go @@ -0,0 +1,176 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateImageSharePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateImageSharePayload{} + +/* + types and functions for parentOrganization +*/ + +// isBoolean +type UpdateImageSharePayloadgetParentOrganizationAttributeType = *bool +type UpdateImageSharePayloadgetParentOrganizationArgType = bool +type UpdateImageSharePayloadgetParentOrganizationRetType = bool + +func getUpdateImageSharePayloadgetParentOrganizationAttributeTypeOk(arg UpdateImageSharePayloadgetParentOrganizationAttributeType) (ret UpdateImageSharePayloadgetParentOrganizationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImageSharePayloadgetParentOrganizationAttributeType(arg *UpdateImageSharePayloadgetParentOrganizationAttributeType, val UpdateImageSharePayloadgetParentOrganizationRetType) { + *arg = &val +} + +/* + types and functions for projects +*/ + +// isArray +type UpdateImageSharePayloadGetProjectsAttributeType = *[]string +type UpdateImageSharePayloadGetProjectsArgType = []string +type UpdateImageSharePayloadGetProjectsRetType = []string + +func getUpdateImageSharePayloadGetProjectsAttributeTypeOk(arg UpdateImageSharePayloadGetProjectsAttributeType) (ret UpdateImageSharePayloadGetProjectsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateImageSharePayloadGetProjectsAttributeType(arg *UpdateImageSharePayloadGetProjectsAttributeType, val UpdateImageSharePayloadGetProjectsRetType) { + *arg = &val +} + +// UpdateImageSharePayload Share details of an Image. For requests ParentOrganization and Projects are mutually exclusive. +type UpdateImageSharePayload struct { + // Image is shared with all projects inside the image owners organization. + ParentOrganization UpdateImageSharePayloadgetParentOrganizationAttributeType `json:"parentOrganization,omitempty"` + // List of all projects the Image is shared with. + Projects UpdateImageSharePayloadGetProjectsAttributeType `json:"projects,omitempty"` +} + +// NewUpdateImageSharePayload instantiates a new UpdateImageSharePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateImageSharePayload() *UpdateImageSharePayload { + this := UpdateImageSharePayload{} + return &this +} + +// NewUpdateImageSharePayloadWithDefaults instantiates a new UpdateImageSharePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateImageSharePayloadWithDefaults() *UpdateImageSharePayload { + this := UpdateImageSharePayload{} + return &this +} + +// GetParentOrganization returns the ParentOrganization field value if set, zero value otherwise. +func (o *UpdateImageSharePayload) GetParentOrganization() (res UpdateImageSharePayloadgetParentOrganizationRetType) { + res, _ = o.GetParentOrganizationOk() + return +} + +// GetParentOrganizationOk returns a tuple with the ParentOrganization field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImageSharePayload) GetParentOrganizationOk() (ret UpdateImageSharePayloadgetParentOrganizationRetType, ok bool) { + return getUpdateImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization) +} + +// HasParentOrganization returns a boolean if a field has been set. +func (o *UpdateImageSharePayload) HasParentOrganization() bool { + _, ok := o.GetParentOrganizationOk() + return ok +} + +// SetParentOrganization gets a reference to the given bool and assigns it to the ParentOrganization field. +func (o *UpdateImageSharePayload) SetParentOrganization(v UpdateImageSharePayloadgetParentOrganizationRetType) { + setUpdateImageSharePayloadgetParentOrganizationAttributeType(&o.ParentOrganization, v) +} + +// GetProjects returns the Projects field value if set, zero value otherwise. +func (o *UpdateImageSharePayload) GetProjects() (res UpdateImageSharePayloadGetProjectsRetType) { + res, _ = o.GetProjectsOk() + return +} + +// GetProjectsOk returns a tuple with the Projects field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateImageSharePayload) GetProjectsOk() (ret UpdateImageSharePayloadGetProjectsRetType, ok bool) { + return getUpdateImageSharePayloadGetProjectsAttributeTypeOk(o.Projects) +} + +// HasProjects returns a boolean if a field has been set. +func (o *UpdateImageSharePayload) HasProjects() bool { + _, ok := o.GetProjectsOk() + return ok +} + +// SetProjects gets a reference to the given []string and assigns it to the Projects field. +func (o *UpdateImageSharePayload) SetProjects(v UpdateImageSharePayloadGetProjectsRetType) { + setUpdateImageSharePayloadGetProjectsAttributeType(&o.Projects, v) +} + +func (o UpdateImageSharePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateImageSharePayloadgetParentOrganizationAttributeTypeOk(o.ParentOrganization); ok { + toSerialize["ParentOrganization"] = val + } + if val, ok := getUpdateImageSharePayloadGetProjectsAttributeTypeOk(o.Projects); ok { + toSerialize["Projects"] = val + } + return toSerialize, nil +} + +type NullableUpdateImageSharePayload struct { + value *UpdateImageSharePayload + isSet bool +} + +func (v NullableUpdateImageSharePayload) Get() *UpdateImageSharePayload { + return v.value +} + +func (v *NullableUpdateImageSharePayload) Set(val *UpdateImageSharePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateImageSharePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateImageSharePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateImageSharePayload(val *UpdateImageSharePayload) *NullableUpdateImageSharePayload { + return &NullableUpdateImageSharePayload{value: val, isSet: true} +} + +func (v NullableUpdateImageSharePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateImageSharePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_key_pair_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_key_pair_payload.go new file mode 100644 index 00000000..92bf21c1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_key_pair_payload.go @@ -0,0 +1,128 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateKeyPairPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateKeyPairPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateKeyPairPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateKeyPairPayloadGetLabelsArgType = map[string]interface{} +type UpdateKeyPairPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateKeyPairPayloadGetLabelsAttributeTypeOk(arg UpdateKeyPairPayloadGetLabelsAttributeType) (ret UpdateKeyPairPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateKeyPairPayloadGetLabelsAttributeType(arg *UpdateKeyPairPayloadGetLabelsAttributeType, val UpdateKeyPairPayloadGetLabelsRetType) { + *arg = &val +} + +// UpdateKeyPairPayload Object that represents an update request body of a public key of an SSH keypair. +type UpdateKeyPairPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateKeyPairPayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +// NewUpdateKeyPairPayload instantiates a new UpdateKeyPairPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateKeyPairPayload() *UpdateKeyPairPayload { + this := UpdateKeyPairPayload{} + return &this +} + +// NewUpdateKeyPairPayloadWithDefaults instantiates a new UpdateKeyPairPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateKeyPairPayloadWithDefaults() *UpdateKeyPairPayload { + this := UpdateKeyPairPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateKeyPairPayload) GetLabels() (res UpdateKeyPairPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateKeyPairPayload) GetLabelsOk() (ret UpdateKeyPairPayloadGetLabelsRetType, ok bool) { + return getUpdateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateKeyPairPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateKeyPairPayload) SetLabels(v UpdateKeyPairPayloadGetLabelsRetType) { + setUpdateKeyPairPayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateKeyPairPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateKeyPairPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateKeyPairPayload struct { + value *UpdateKeyPairPayload + isSet bool +} + +func (v NullableUpdateKeyPairPayload) Get() *UpdateKeyPairPayload { + return v.value +} + +func (v *NullableUpdateKeyPairPayload) Set(val *UpdateKeyPairPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateKeyPairPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateKeyPairPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateKeyPairPayload(val *UpdateKeyPairPayload) *NullableUpdateKeyPairPayload { + return &NullableUpdateKeyPairPayload{value: val, isSet: true} +} + +func (v NullableUpdateKeyPairPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateKeyPairPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_address_family.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_address_family.go new file mode 100644 index 00000000..bd5dc481 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_address_family.go @@ -0,0 +1,174 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkAddressFamily type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkAddressFamily{} + +/* + types and functions for ipv4 +*/ + +// isModel +type UpdateNetworkAddressFamilyGetIpv4AttributeType = *UpdateNetworkIPv4Body +type UpdateNetworkAddressFamilyGetIpv4ArgType = UpdateNetworkIPv4Body +type UpdateNetworkAddressFamilyGetIpv4RetType = UpdateNetworkIPv4Body + +func getUpdateNetworkAddressFamilyGetIpv4AttributeTypeOk(arg UpdateNetworkAddressFamilyGetIpv4AttributeType) (ret UpdateNetworkAddressFamilyGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkAddressFamilyGetIpv4AttributeType(arg *UpdateNetworkAddressFamilyGetIpv4AttributeType, val UpdateNetworkAddressFamilyGetIpv4RetType) { + *arg = &val +} + +/* + types and functions for ipv6 +*/ + +// isModel +type UpdateNetworkAddressFamilyGetIpv6AttributeType = *UpdateNetworkIPv6Body +type UpdateNetworkAddressFamilyGetIpv6ArgType = UpdateNetworkIPv6Body +type UpdateNetworkAddressFamilyGetIpv6RetType = UpdateNetworkIPv6Body + +func getUpdateNetworkAddressFamilyGetIpv6AttributeTypeOk(arg UpdateNetworkAddressFamilyGetIpv6AttributeType) (ret UpdateNetworkAddressFamilyGetIpv6RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkAddressFamilyGetIpv6AttributeType(arg *UpdateNetworkAddressFamilyGetIpv6AttributeType, val UpdateNetworkAddressFamilyGetIpv6RetType) { + *arg = &val +} + +// UpdateNetworkAddressFamily The addressFamily object for a network update request. +type UpdateNetworkAddressFamily struct { + Ipv4 UpdateNetworkAddressFamilyGetIpv4AttributeType `json:"ipv4,omitempty"` + Ipv6 UpdateNetworkAddressFamilyGetIpv6AttributeType `json:"ipv6,omitempty"` +} + +// NewUpdateNetworkAddressFamily instantiates a new UpdateNetworkAddressFamily object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateNetworkAddressFamily() *UpdateNetworkAddressFamily { + this := UpdateNetworkAddressFamily{} + return &this +} + +// NewUpdateNetworkAddressFamilyWithDefaults instantiates a new UpdateNetworkAddressFamily object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateNetworkAddressFamilyWithDefaults() *UpdateNetworkAddressFamily { + this := UpdateNetworkAddressFamily{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *UpdateNetworkAddressFamily) GetIpv4() (res UpdateNetworkAddressFamilyGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkAddressFamily) GetIpv4Ok() (ret UpdateNetworkAddressFamilyGetIpv4RetType, ok bool) { + return getUpdateNetworkAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *UpdateNetworkAddressFamily) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given UpdateNetworkIPv4Body and assigns it to the Ipv4 field. +func (o *UpdateNetworkAddressFamily) SetIpv4(v UpdateNetworkAddressFamilyGetIpv4RetType) { + setUpdateNetworkAddressFamilyGetIpv4AttributeType(&o.Ipv4, v) +} + +// GetIpv6 returns the Ipv6 field value if set, zero value otherwise. +func (o *UpdateNetworkAddressFamily) GetIpv6() (res UpdateNetworkAddressFamilyGetIpv6RetType) { + res, _ = o.GetIpv6Ok() + return +} + +// GetIpv6Ok returns a tuple with the Ipv6 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkAddressFamily) GetIpv6Ok() (ret UpdateNetworkAddressFamilyGetIpv6RetType, ok bool) { + return getUpdateNetworkAddressFamilyGetIpv6AttributeTypeOk(o.Ipv6) +} + +// HasIpv6 returns a boolean if a field has been set. +func (o *UpdateNetworkAddressFamily) HasIpv6() bool { + _, ok := o.GetIpv6Ok() + return ok +} + +// SetIpv6 gets a reference to the given UpdateNetworkIPv6Body and assigns it to the Ipv6 field. +func (o *UpdateNetworkAddressFamily) SetIpv6(v UpdateNetworkAddressFamilyGetIpv6RetType) { + setUpdateNetworkAddressFamilyGetIpv6AttributeType(&o.Ipv6, v) +} + +func (o UpdateNetworkAddressFamily) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkAddressFamilyGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + if val, ok := getUpdateNetworkAddressFamilyGetIpv6AttributeTypeOk(o.Ipv6); ok { + toSerialize["Ipv6"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkAddressFamily struct { + value *UpdateNetworkAddressFamily + isSet bool +} + +func (v NullableUpdateNetworkAddressFamily) Get() *UpdateNetworkAddressFamily { + return v.value +} + +func (v *NullableUpdateNetworkAddressFamily) Set(val *UpdateNetworkAddressFamily) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkAddressFamily) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkAddressFamily) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkAddressFamily(val *UpdateNetworkAddressFamily) *NullableUpdateNetworkAddressFamily { + return &NullableUpdateNetworkAddressFamily{value: val, isSet: true} +} + +func (v NullableUpdateNetworkAddressFamily) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkAddressFamily) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_area_region_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_area_region_payload.go new file mode 100644 index 00000000..a019ccf3 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_area_region_payload.go @@ -0,0 +1,127 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkAreaRegionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkAreaRegionPayload{} + +/* + types and functions for ipv4 +*/ + +// isModel +type UpdateNetworkAreaRegionPayloadGetIpv4AttributeType = *UpdateRegionalAreaIPv4 +type UpdateNetworkAreaRegionPayloadGetIpv4ArgType = UpdateRegionalAreaIPv4 +type UpdateNetworkAreaRegionPayloadGetIpv4RetType = UpdateRegionalAreaIPv4 + +func getUpdateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(arg UpdateNetworkAreaRegionPayloadGetIpv4AttributeType) (ret UpdateNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkAreaRegionPayloadGetIpv4AttributeType(arg *UpdateNetworkAreaRegionPayloadGetIpv4AttributeType, val UpdateNetworkAreaRegionPayloadGetIpv4RetType) { + *arg = &val +} + +// UpdateNetworkAreaRegionPayload Object that represents the request body for a regional network area update. +type UpdateNetworkAreaRegionPayload struct { + Ipv4 UpdateNetworkAreaRegionPayloadGetIpv4AttributeType `json:"ipv4,omitempty"` +} + +// NewUpdateNetworkAreaRegionPayload instantiates a new UpdateNetworkAreaRegionPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateNetworkAreaRegionPayload() *UpdateNetworkAreaRegionPayload { + this := UpdateNetworkAreaRegionPayload{} + return &this +} + +// NewUpdateNetworkAreaRegionPayloadWithDefaults instantiates a new UpdateNetworkAreaRegionPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateNetworkAreaRegionPayloadWithDefaults() *UpdateNetworkAreaRegionPayload { + this := UpdateNetworkAreaRegionPayload{} + return &this +} + +// GetIpv4 returns the Ipv4 field value if set, zero value otherwise. +func (o *UpdateNetworkAreaRegionPayload) GetIpv4() (res UpdateNetworkAreaRegionPayloadGetIpv4RetType) { + res, _ = o.GetIpv4Ok() + return +} + +// GetIpv4Ok returns a tuple with the Ipv4 field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkAreaRegionPayload) GetIpv4Ok() (ret UpdateNetworkAreaRegionPayloadGetIpv4RetType, ok bool) { + return getUpdateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4) +} + +// HasIpv4 returns a boolean if a field has been set. +func (o *UpdateNetworkAreaRegionPayload) HasIpv4() bool { + _, ok := o.GetIpv4Ok() + return ok +} + +// SetIpv4 gets a reference to the given UpdateRegionalAreaIPv4 and assigns it to the Ipv4 field. +func (o *UpdateNetworkAreaRegionPayload) SetIpv4(v UpdateNetworkAreaRegionPayloadGetIpv4RetType) { + setUpdateNetworkAreaRegionPayloadGetIpv4AttributeType(&o.Ipv4, v) +} + +func (o UpdateNetworkAreaRegionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkAreaRegionPayloadGetIpv4AttributeTypeOk(o.Ipv4); ok { + toSerialize["Ipv4"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkAreaRegionPayload struct { + value *UpdateNetworkAreaRegionPayload + isSet bool +} + +func (v NullableUpdateNetworkAreaRegionPayload) Get() *UpdateNetworkAreaRegionPayload { + return v.value +} + +func (v *NullableUpdateNetworkAreaRegionPayload) Set(val *UpdateNetworkAreaRegionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkAreaRegionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkAreaRegionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkAreaRegionPayload(val *UpdateNetworkAreaRegionPayload) *NullableUpdateNetworkAreaRegionPayload { + return &NullableUpdateNetworkAreaRegionPayload{value: val, isSet: true} +} + +func (v NullableUpdateNetworkAreaRegionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkAreaRegionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_area_route_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_area_route_payload.go new file mode 100644 index 00000000..0629a15a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_area_route_payload.go @@ -0,0 +1,128 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkAreaRoutePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkAreaRoutePayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateNetworkAreaRoutePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateNetworkAreaRoutePayloadGetLabelsArgType = map[string]interface{} +type UpdateNetworkAreaRoutePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateNetworkAreaRoutePayloadGetLabelsAttributeTypeOk(arg UpdateNetworkAreaRoutePayloadGetLabelsAttributeType) (ret UpdateNetworkAreaRoutePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkAreaRoutePayloadGetLabelsAttributeType(arg *UpdateNetworkAreaRoutePayloadGetLabelsAttributeType, val UpdateNetworkAreaRoutePayloadGetLabelsRetType) { + *arg = &val +} + +// UpdateNetworkAreaRoutePayload Object that represents the request body for a route update. +type UpdateNetworkAreaRoutePayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateNetworkAreaRoutePayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +// NewUpdateNetworkAreaRoutePayload instantiates a new UpdateNetworkAreaRoutePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateNetworkAreaRoutePayload() *UpdateNetworkAreaRoutePayload { + this := UpdateNetworkAreaRoutePayload{} + return &this +} + +// NewUpdateNetworkAreaRoutePayloadWithDefaults instantiates a new UpdateNetworkAreaRoutePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateNetworkAreaRoutePayloadWithDefaults() *UpdateNetworkAreaRoutePayload { + this := UpdateNetworkAreaRoutePayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateNetworkAreaRoutePayload) GetLabels() (res UpdateNetworkAreaRoutePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkAreaRoutePayload) GetLabelsOk() (ret UpdateNetworkAreaRoutePayloadGetLabelsRetType, ok bool) { + return getUpdateNetworkAreaRoutePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateNetworkAreaRoutePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateNetworkAreaRoutePayload) SetLabels(v UpdateNetworkAreaRoutePayloadGetLabelsRetType) { + setUpdateNetworkAreaRoutePayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateNetworkAreaRoutePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkAreaRoutePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkAreaRoutePayload struct { + value *UpdateNetworkAreaRoutePayload + isSet bool +} + +func (v NullableUpdateNetworkAreaRoutePayload) Get() *UpdateNetworkAreaRoutePayload { + return v.value +} + +func (v *NullableUpdateNetworkAreaRoutePayload) Set(val *UpdateNetworkAreaRoutePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkAreaRoutePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkAreaRoutePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkAreaRoutePayload(val *UpdateNetworkAreaRoutePayload) *NullableUpdateNetworkAreaRoutePayload { + return &NullableUpdateNetworkAreaRoutePayload{value: val, isSet: true} +} + +func (v NullableUpdateNetworkAreaRoutePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkAreaRoutePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_ipv4_body.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_ipv4_body.go new file mode 100644 index 00000000..1687f535 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_ipv4_body.go @@ -0,0 +1,192 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkIPv4Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkIPv4Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type UpdateNetworkIPv4BodyGetGatewayAttributeType = *NullableString + +func getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv4BodyGetGatewayAttributeType) (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateNetworkIPv4BodyGetGatewayAttributeType(arg *UpdateNetworkIPv4BodyGetGatewayAttributeType, val UpdateNetworkIPv4BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateNetworkIPv4BodyGetGatewayArgType = *string +type UpdateNetworkIPv4BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type UpdateNetworkIPv4BodyGetNameserversAttributeType = *[]string +type UpdateNetworkIPv4BodyGetNameserversArgType = []string +type UpdateNetworkIPv4BodyGetNameserversRetType = []string + +func getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv4BodyGetNameserversAttributeType) (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkIPv4BodyGetNameserversAttributeType(arg *UpdateNetworkIPv4BodyGetNameserversAttributeType, val UpdateNetworkIPv4BodyGetNameserversRetType) { + *arg = &val +} + +// UpdateNetworkIPv4Body The config object for a IPv4 network update. +type UpdateNetworkIPv4Body struct { + // The IPv4 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway UpdateNetworkIPv4BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv4. + Nameservers UpdateNetworkIPv4BodyGetNameserversAttributeType `json:"nameservers,omitempty"` +} + +// NewUpdateNetworkIPv4Body instantiates a new UpdateNetworkIPv4Body object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateNetworkIPv4Body() *UpdateNetworkIPv4Body { + this := UpdateNetworkIPv4Body{} + return &this +} + +// NewUpdateNetworkIPv4BodyWithDefaults instantiates a new UpdateNetworkIPv4Body object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateNetworkIPv4BodyWithDefaults() *UpdateNetworkIPv4Body { + this := UpdateNetworkIPv4Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateNetworkIPv4Body) GetGateway() (res UpdateNetworkIPv4BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateNetworkIPv4Body) GetGatewayOk() (ret UpdateNetworkIPv4BodyGetGatewayRetType, ok bool) { + return getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *UpdateNetworkIPv4Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv4Body) SetGateway(v UpdateNetworkIPv4BodyGetGatewayRetType) { + setUpdateNetworkIPv4BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *UpdateNetworkIPv4Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *UpdateNetworkIPv4Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *UpdateNetworkIPv4Body) GetNameservers() (res UpdateNetworkIPv4BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkIPv4Body) GetNameserversOk() (ret UpdateNetworkIPv4BodyGetNameserversRetType, ok bool) { + return getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *UpdateNetworkIPv4Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *UpdateNetworkIPv4Body) SetNameservers(v UpdateNetworkIPv4BodyGetNameserversRetType) { + setUpdateNetworkIPv4BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +func (o UpdateNetworkIPv4Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkIPv4BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getUpdateNetworkIPv4BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkIPv4Body struct { + value *UpdateNetworkIPv4Body + isSet bool +} + +func (v NullableUpdateNetworkIPv4Body) Get() *UpdateNetworkIPv4Body { + return v.value +} + +func (v *NullableUpdateNetworkIPv4Body) Set(val *UpdateNetworkIPv4Body) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkIPv4Body) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkIPv4Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkIPv4Body(val *UpdateNetworkIPv4Body) *NullableUpdateNetworkIPv4Body { + return &NullableUpdateNetworkIPv4Body{value: val, isSet: true} +} + +func (v NullableUpdateNetworkIPv4Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkIPv4Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_ipv6_body.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_ipv6_body.go new file mode 100644 index 00000000..59d0d805 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_network_ipv6_body.go @@ -0,0 +1,192 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateNetworkIPv6Body type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNetworkIPv6Body{} + +/* + types and functions for gateway +*/ + +// isNullableString +type UpdateNetworkIPv6BodyGetGatewayAttributeType = *NullableString + +func getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(arg UpdateNetworkIPv6BodyGetGatewayAttributeType) (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdateNetworkIPv6BodyGetGatewayAttributeType(arg *UpdateNetworkIPv6BodyGetGatewayAttributeType, val UpdateNetworkIPv6BodyGetGatewayRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdateNetworkIPv6BodyGetGatewayArgType = *string +type UpdateNetworkIPv6BodyGetGatewayRetType = *string + +/* + types and functions for nameservers +*/ + +// isArray +type UpdateNetworkIPv6BodyGetNameserversAttributeType = *[]string +type UpdateNetworkIPv6BodyGetNameserversArgType = []string +type UpdateNetworkIPv6BodyGetNameserversRetType = []string + +func getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(arg UpdateNetworkIPv6BodyGetNameserversAttributeType) (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNetworkIPv6BodyGetNameserversAttributeType(arg *UpdateNetworkIPv6BodyGetNameserversAttributeType, val UpdateNetworkIPv6BodyGetNameserversRetType) { + *arg = &val +} + +// UpdateNetworkIPv6Body The config object for a IPv6 network update. +type UpdateNetworkIPv6Body struct { + // The IPv6 gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. + Gateway UpdateNetworkIPv6BodyGetGatewayAttributeType `json:"gateway,omitempty"` + // A list containing DNS Servers/Nameservers for IPv6. + Nameservers UpdateNetworkIPv6BodyGetNameserversAttributeType `json:"nameservers,omitempty"` +} + +// NewUpdateNetworkIPv6Body instantiates a new UpdateNetworkIPv6Body object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateNetworkIPv6Body() *UpdateNetworkIPv6Body { + this := UpdateNetworkIPv6Body{} + return &this +} + +// NewUpdateNetworkIPv6BodyWithDefaults instantiates a new UpdateNetworkIPv6Body object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateNetworkIPv6BodyWithDefaults() *UpdateNetworkIPv6Body { + this := UpdateNetworkIPv6Body{} + return &this +} + +// GetGateway returns the Gateway field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateNetworkIPv6Body) GetGateway() (res UpdateNetworkIPv6BodyGetGatewayRetType) { + res, _ = o.GetGatewayOk() + return +} + +// GetGatewayOk returns a tuple with the Gateway field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdateNetworkIPv6Body) GetGatewayOk() (ret UpdateNetworkIPv6BodyGetGatewayRetType, ok bool) { + return getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway) +} + +// HasGateway returns a boolean if a field has been set. +func (o *UpdateNetworkIPv6Body) HasGateway() bool { + _, ok := o.GetGatewayOk() + return ok +} + +// SetGateway gets a reference to the given string and assigns it to the Gateway field. +func (o *UpdateNetworkIPv6Body) SetGateway(v UpdateNetworkIPv6BodyGetGatewayRetType) { + setUpdateNetworkIPv6BodyGetGatewayAttributeType(&o.Gateway, v) +} + +// SetGatewayNil sets the value for Gateway to be an explicit nil +func (o *UpdateNetworkIPv6Body) SetGatewayNil() { + o.Gateway = nil +} + +// UnsetGateway ensures that no value is present for Gateway, not even an explicit nil +func (o *UpdateNetworkIPv6Body) UnsetGateway() { + o.Gateway = nil +} + +// GetNameservers returns the Nameservers field value if set, zero value otherwise. +func (o *UpdateNetworkIPv6Body) GetNameservers() (res UpdateNetworkIPv6BodyGetNameserversRetType) { + res, _ = o.GetNameserversOk() + return +} + +// GetNameserversOk returns a tuple with the Nameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNetworkIPv6Body) GetNameserversOk() (ret UpdateNetworkIPv6BodyGetNameserversRetType, ok bool) { + return getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers) +} + +// HasNameservers returns a boolean if a field has been set. +func (o *UpdateNetworkIPv6Body) HasNameservers() bool { + _, ok := o.GetNameserversOk() + return ok +} + +// SetNameservers gets a reference to the given []string and assigns it to the Nameservers field. +func (o *UpdateNetworkIPv6Body) SetNameservers(v UpdateNetworkIPv6BodyGetNameserversRetType) { + setUpdateNetworkIPv6BodyGetNameserversAttributeType(&o.Nameservers, v) +} + +func (o UpdateNetworkIPv6Body) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNetworkIPv6BodyGetGatewayAttributeTypeOk(o.Gateway); ok { + toSerialize["Gateway"] = val + } + if val, ok := getUpdateNetworkIPv6BodyGetNameserversAttributeTypeOk(o.Nameservers); ok { + toSerialize["Nameservers"] = val + } + return toSerialize, nil +} + +type NullableUpdateNetworkIPv6Body struct { + value *UpdateNetworkIPv6Body + isSet bool +} + +func (v NullableUpdateNetworkIPv6Body) Get() *UpdateNetworkIPv6Body { + return v.value +} + +func (v *NullableUpdateNetworkIPv6Body) Set(val *UpdateNetworkIPv6Body) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNetworkIPv6Body) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNetworkIPv6Body) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNetworkIPv6Body(val *UpdateNetworkIPv6Body) *NullableUpdateNetworkIPv6Body { + return &NullableUpdateNetworkIPv6Body{value: val, isSet: true} +} + +func (v NullableUpdateNetworkIPv6Body) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNetworkIPv6Body) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_nic_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_nic_payload.go new file mode 100644 index 00000000..4de96617 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_nic_payload.go @@ -0,0 +1,370 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateNicPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateNicPayload{} + +/* + types and functions for allowedAddresses +*/ + +// isArray +type UpdateNicPayloadGetAllowedAddressesAttributeType = *[]AllowedAddressesInner +type UpdateNicPayloadGetAllowedAddressesArgType = []AllowedAddressesInner +type UpdateNicPayloadGetAllowedAddressesRetType = []AllowedAddressesInner + +func getUpdateNicPayloadGetAllowedAddressesAttributeTypeOk(arg UpdateNicPayloadGetAllowedAddressesAttributeType) (ret UpdateNicPayloadGetAllowedAddressesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetAllowedAddressesAttributeType(arg *UpdateNicPayloadGetAllowedAddressesAttributeType, val UpdateNicPayloadGetAllowedAddressesRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateNicPayloadGetDescriptionAttributeType = *string + +func getUpdateNicPayloadGetDescriptionAttributeTypeOk(arg UpdateNicPayloadGetDescriptionAttributeType) (ret UpdateNicPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetDescriptionAttributeType(arg *UpdateNicPayloadGetDescriptionAttributeType, val UpdateNicPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateNicPayloadGetDescriptionArgType = string +type UpdateNicPayloadGetDescriptionRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateNicPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateNicPayloadGetLabelsArgType = map[string]interface{} +type UpdateNicPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateNicPayloadGetLabelsAttributeTypeOk(arg UpdateNicPayloadGetLabelsAttributeType) (ret UpdateNicPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetLabelsAttributeType(arg *UpdateNicPayloadGetLabelsAttributeType, val UpdateNicPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateNicPayloadGetNameAttributeType = *string + +func getUpdateNicPayloadGetNameAttributeTypeOk(arg UpdateNicPayloadGetNameAttributeType) (ret UpdateNicPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetNameAttributeType(arg *UpdateNicPayloadGetNameAttributeType, val UpdateNicPayloadGetNameRetType) { + *arg = &val +} + +type UpdateNicPayloadGetNameArgType = string +type UpdateNicPayloadGetNameRetType = string + +/* + types and functions for nicSecurity +*/ + +// isBoolean +type UpdateNicPayloadgetNicSecurityAttributeType = *bool +type UpdateNicPayloadgetNicSecurityArgType = bool +type UpdateNicPayloadgetNicSecurityRetType = bool + +func getUpdateNicPayloadgetNicSecurityAttributeTypeOk(arg UpdateNicPayloadgetNicSecurityAttributeType) (ret UpdateNicPayloadgetNicSecurityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadgetNicSecurityAttributeType(arg *UpdateNicPayloadgetNicSecurityAttributeType, val UpdateNicPayloadgetNicSecurityRetType) { + *arg = &val +} + +/* + types and functions for securityGroups +*/ + +// isArray +type UpdateNicPayloadGetSecurityGroupsAttributeType = *[]string +type UpdateNicPayloadGetSecurityGroupsArgType = []string +type UpdateNicPayloadGetSecurityGroupsRetType = []string + +func getUpdateNicPayloadGetSecurityGroupsAttributeTypeOk(arg UpdateNicPayloadGetSecurityGroupsAttributeType) (ret UpdateNicPayloadGetSecurityGroupsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateNicPayloadGetSecurityGroupsAttributeType(arg *UpdateNicPayloadGetSecurityGroupsAttributeType, val UpdateNicPayloadGetSecurityGroupsRetType) { + *arg = &val +} + +// UpdateNicPayload Object that represents a network interface update. +type UpdateNicPayload struct { + // A list of IPs or CIDR notations. + AllowedAddresses UpdateNicPayloadGetAllowedAddressesAttributeType `json:"allowedAddresses,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description UpdateNicPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateNicPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateNicPayloadGetNameAttributeType `json:"name,omitempty"` + // If this is set to false, then no security groups will apply to this network interface. + NicSecurity UpdateNicPayloadgetNicSecurityAttributeType `json:"nicSecurity,omitempty"` + // A list of UUIDs. + SecurityGroups UpdateNicPayloadGetSecurityGroupsAttributeType `json:"securityGroups,omitempty"` +} + +// NewUpdateNicPayload instantiates a new UpdateNicPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateNicPayload() *UpdateNicPayload { + this := UpdateNicPayload{} + return &this +} + +// NewUpdateNicPayloadWithDefaults instantiates a new UpdateNicPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateNicPayloadWithDefaults() *UpdateNicPayload { + this := UpdateNicPayload{} + return &this +} + +// GetAllowedAddresses returns the AllowedAddresses field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetAllowedAddresses() (res UpdateNicPayloadGetAllowedAddressesRetType) { + res, _ = o.GetAllowedAddressesOk() + return +} + +// GetAllowedAddressesOk returns a tuple with the AllowedAddresses field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetAllowedAddressesOk() (ret UpdateNicPayloadGetAllowedAddressesRetType, ok bool) { + return getUpdateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses) +} + +// HasAllowedAddresses returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasAllowedAddresses() bool { + _, ok := o.GetAllowedAddressesOk() + return ok +} + +// SetAllowedAddresses gets a reference to the given []AllowedAddressesInner and assigns it to the AllowedAddresses field. +func (o *UpdateNicPayload) SetAllowedAddresses(v UpdateNicPayloadGetAllowedAddressesRetType) { + setUpdateNicPayloadGetAllowedAddressesAttributeType(&o.AllowedAddresses, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetDescription() (res UpdateNicPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetDescriptionOk() (ret UpdateNicPayloadGetDescriptionRetType, ok bool) { + return getUpdateNicPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateNicPayload) SetDescription(v UpdateNicPayloadGetDescriptionRetType) { + setUpdateNicPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetLabels() (res UpdateNicPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetLabelsOk() (ret UpdateNicPayloadGetLabelsRetType, ok bool) { + return getUpdateNicPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateNicPayload) SetLabels(v UpdateNicPayloadGetLabelsRetType) { + setUpdateNicPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetName() (res UpdateNicPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetNameOk() (ret UpdateNicPayloadGetNameRetType, ok bool) { + return getUpdateNicPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateNicPayload) SetName(v UpdateNicPayloadGetNameRetType) { + setUpdateNicPayloadGetNameAttributeType(&o.Name, v) +} + +// GetNicSecurity returns the NicSecurity field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetNicSecurity() (res UpdateNicPayloadgetNicSecurityRetType) { + res, _ = o.GetNicSecurityOk() + return +} + +// GetNicSecurityOk returns a tuple with the NicSecurity field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetNicSecurityOk() (ret UpdateNicPayloadgetNicSecurityRetType, ok bool) { + return getUpdateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity) +} + +// HasNicSecurity returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasNicSecurity() bool { + _, ok := o.GetNicSecurityOk() + return ok +} + +// SetNicSecurity gets a reference to the given bool and assigns it to the NicSecurity field. +func (o *UpdateNicPayload) SetNicSecurity(v UpdateNicPayloadgetNicSecurityRetType) { + setUpdateNicPayloadgetNicSecurityAttributeType(&o.NicSecurity, v) +} + +// GetSecurityGroups returns the SecurityGroups field value if set, zero value otherwise. +func (o *UpdateNicPayload) GetSecurityGroups() (res UpdateNicPayloadGetSecurityGroupsRetType) { + res, _ = o.GetSecurityGroupsOk() + return +} + +// GetSecurityGroupsOk returns a tuple with the SecurityGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateNicPayload) GetSecurityGroupsOk() (ret UpdateNicPayloadGetSecurityGroupsRetType, ok bool) { + return getUpdateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups) +} + +// HasSecurityGroups returns a boolean if a field has been set. +func (o *UpdateNicPayload) HasSecurityGroups() bool { + _, ok := o.GetSecurityGroupsOk() + return ok +} + +// SetSecurityGroups gets a reference to the given []string and assigns it to the SecurityGroups field. +func (o *UpdateNicPayload) SetSecurityGroups(v UpdateNicPayloadGetSecurityGroupsRetType) { + setUpdateNicPayloadGetSecurityGroupsAttributeType(&o.SecurityGroups, v) +} + +func (o UpdateNicPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateNicPayloadGetAllowedAddressesAttributeTypeOk(o.AllowedAddresses); ok { + toSerialize["AllowedAddresses"] = val + } + if val, ok := getUpdateNicPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateNicPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateNicPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateNicPayloadgetNicSecurityAttributeTypeOk(o.NicSecurity); ok { + toSerialize["NicSecurity"] = val + } + if val, ok := getUpdateNicPayloadGetSecurityGroupsAttributeTypeOk(o.SecurityGroups); ok { + toSerialize["SecurityGroups"] = val + } + return toSerialize, nil +} + +type NullableUpdateNicPayload struct { + value *UpdateNicPayload + isSet bool +} + +func (v NullableUpdateNicPayload) Get() *UpdateNicPayload { + return v.value +} + +func (v *NullableUpdateNicPayload) Set(val *UpdateNicPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateNicPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateNicPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateNicPayload(val *UpdateNicPayload) *NullableUpdateNicPayload { + return &NullableUpdateNicPayload{value: val, isSet: true} +} + +func (v NullableUpdateNicPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateNicPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_public_ip_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_public_ip_payload.go new file mode 100644 index 00000000..afe67b7f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_public_ip_payload.go @@ -0,0 +1,290 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdatePublicIPPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdatePublicIPPayload{} + +/* + types and functions for id +*/ + +// isNotNullableString +type UpdatePublicIPPayloadGetIdAttributeType = *string + +func getUpdatePublicIPPayloadGetIdAttributeTypeOk(arg UpdatePublicIPPayloadGetIdAttributeType) (ret UpdatePublicIPPayloadGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdatePublicIPPayloadGetIdAttributeType(arg *UpdatePublicIPPayloadGetIdAttributeType, val UpdatePublicIPPayloadGetIdRetType) { + *arg = &val +} + +type UpdatePublicIPPayloadGetIdArgType = string +type UpdatePublicIPPayloadGetIdRetType = string + +/* + types and functions for ip +*/ + +// isNotNullableString +type UpdatePublicIPPayloadGetIpAttributeType = *string + +func getUpdatePublicIPPayloadGetIpAttributeTypeOk(arg UpdatePublicIPPayloadGetIpAttributeType) (ret UpdatePublicIPPayloadGetIpRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdatePublicIPPayloadGetIpAttributeType(arg *UpdatePublicIPPayloadGetIpAttributeType, val UpdatePublicIPPayloadGetIpRetType) { + *arg = &val +} + +type UpdatePublicIPPayloadGetIpArgType = string +type UpdatePublicIPPayloadGetIpRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdatePublicIPPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdatePublicIPPayloadGetLabelsArgType = map[string]interface{} +type UpdatePublicIPPayloadGetLabelsRetType = map[string]interface{} + +func getUpdatePublicIPPayloadGetLabelsAttributeTypeOk(arg UpdatePublicIPPayloadGetLabelsAttributeType) (ret UpdatePublicIPPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdatePublicIPPayloadGetLabelsAttributeType(arg *UpdatePublicIPPayloadGetLabelsAttributeType, val UpdatePublicIPPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for networkInterface +*/ + +// isNullableString +type UpdatePublicIPPayloadGetNetworkInterfaceAttributeType = *NullableString + +func getUpdatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(arg UpdatePublicIPPayloadGetNetworkInterfaceAttributeType) (ret UpdatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + if arg == nil { + return nil, false + } + return arg.Get(), true +} + +func setUpdatePublicIPPayloadGetNetworkInterfaceAttributeType(arg *UpdatePublicIPPayloadGetNetworkInterfaceAttributeType, val UpdatePublicIPPayloadGetNetworkInterfaceRetType) { + if IsNil(*arg) { + *arg = NewNullableString(val) + } else { + (*arg).Set(val) + } +} + +type UpdatePublicIPPayloadGetNetworkInterfaceArgType = *string +type UpdatePublicIPPayloadGetNetworkInterfaceRetType = *string + +// UpdatePublicIPPayload Object that represents a public IP. +type UpdatePublicIPPayload struct { + // Universally Unique Identifier (UUID). + Id UpdatePublicIPPayloadGetIdAttributeType `json:"id,omitempty"` + // String that represents an IPv4 address. + Ip UpdatePublicIPPayloadGetIpAttributeType `json:"ip,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdatePublicIPPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Universally Unique Identifier (UUID). + NetworkInterface UpdatePublicIPPayloadGetNetworkInterfaceAttributeType `json:"networkInterface,omitempty"` +} + +// NewUpdatePublicIPPayload instantiates a new UpdatePublicIPPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdatePublicIPPayload() *UpdatePublicIPPayload { + this := UpdatePublicIPPayload{} + return &this +} + +// NewUpdatePublicIPPayloadWithDefaults instantiates a new UpdatePublicIPPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdatePublicIPPayloadWithDefaults() *UpdatePublicIPPayload { + this := UpdatePublicIPPayload{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) GetId() (res UpdatePublicIPPayloadGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdatePublicIPPayload) GetIdOk() (ret UpdatePublicIPPayloadGetIdRetType, ok bool) { + return getUpdatePublicIPPayloadGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *UpdatePublicIPPayload) SetId(v UpdatePublicIPPayloadGetIdRetType) { + setUpdatePublicIPPayloadGetIdAttributeType(&o.Id, v) +} + +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) GetIp() (res UpdatePublicIPPayloadGetIpRetType) { + res, _ = o.GetIpOk() + return +} + +// GetIpOk returns a tuple with the Ip field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdatePublicIPPayload) GetIpOk() (ret UpdatePublicIPPayloadGetIpRetType, ok bool) { + return getUpdatePublicIPPayloadGetIpAttributeTypeOk(o.Ip) +} + +// HasIp returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasIp() bool { + _, ok := o.GetIpOk() + return ok +} + +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *UpdatePublicIPPayload) SetIp(v UpdatePublicIPPayloadGetIpRetType) { + setUpdatePublicIPPayloadGetIpAttributeType(&o.Ip, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdatePublicIPPayload) GetLabels() (res UpdatePublicIPPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdatePublicIPPayload) GetLabelsOk() (ret UpdatePublicIPPayloadGetLabelsRetType, ok bool) { + return getUpdatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdatePublicIPPayload) SetLabels(v UpdatePublicIPPayloadGetLabelsRetType) { + setUpdatePublicIPPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetNetworkInterface returns the NetworkInterface field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdatePublicIPPayload) GetNetworkInterface() (res UpdatePublicIPPayloadGetNetworkInterfaceRetType) { + res, _ = o.GetNetworkInterfaceOk() + return +} + +// GetNetworkInterfaceOk returns a tuple with the NetworkInterface field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *UpdatePublicIPPayload) GetNetworkInterfaceOk() (ret UpdatePublicIPPayloadGetNetworkInterfaceRetType, ok bool) { + return getUpdatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface) +} + +// HasNetworkInterface returns a boolean if a field has been set. +func (o *UpdatePublicIPPayload) HasNetworkInterface() bool { + _, ok := o.GetNetworkInterfaceOk() + return ok +} + +// SetNetworkInterface gets a reference to the given string and assigns it to the NetworkInterface field. +func (o *UpdatePublicIPPayload) SetNetworkInterface(v UpdatePublicIPPayloadGetNetworkInterfaceRetType) { + setUpdatePublicIPPayloadGetNetworkInterfaceAttributeType(&o.NetworkInterface, v) +} + +// SetNetworkInterfaceNil sets the value for NetworkInterface to be an explicit nil +func (o *UpdatePublicIPPayload) SetNetworkInterfaceNil() { + o.NetworkInterface = nil +} + +// UnsetNetworkInterface ensures that no value is present for NetworkInterface, not even an explicit nil +func (o *UpdatePublicIPPayload) UnsetNetworkInterface() { + o.NetworkInterface = nil +} + +func (o UpdatePublicIPPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdatePublicIPPayloadGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getUpdatePublicIPPayloadGetIpAttributeTypeOk(o.Ip); ok { + toSerialize["Ip"] = val + } + if val, ok := getUpdatePublicIPPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdatePublicIPPayloadGetNetworkInterfaceAttributeTypeOk(o.NetworkInterface); ok { + toSerialize["NetworkInterface"] = val + } + return toSerialize, nil +} + +type NullableUpdatePublicIPPayload struct { + value *UpdatePublicIPPayload + isSet bool +} + +func (v NullableUpdatePublicIPPayload) Get() *UpdatePublicIPPayload { + return v.value +} + +func (v *NullableUpdatePublicIPPayload) Set(val *UpdatePublicIPPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdatePublicIPPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdatePublicIPPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdatePublicIPPayload(val *UpdatePublicIPPayload) *NullableUpdatePublicIPPayload { + return &NullableUpdatePublicIPPayload{value: val, isSet: true} +} + +func (v NullableUpdatePublicIPPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdatePublicIPPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_regional_area_ipv4.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_regional_area_ipv4.go new file mode 100644 index 00000000..e4437a5d --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_regional_area_ipv4.go @@ -0,0 +1,271 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateRegionalAreaIPv4 type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRegionalAreaIPv4{} + +/* + types and functions for defaultNameservers +*/ + +// isArray +type UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType = *[]string +type UpdateRegionalAreaIPv4GetDefaultNameserversArgType = []string +type UpdateRegionalAreaIPv4GetDefaultNameserversRetType = []string + +func getUpdateRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(arg UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType) (ret UpdateRegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetDefaultNameserversAttributeType(arg *UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType, val UpdateRegionalAreaIPv4GetDefaultNameserversRetType) { + *arg = &val +} + +/* + types and functions for defaultPrefixLen +*/ + +// isLong +type UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType = *int64 +type UpdateRegionalAreaIPv4GetDefaultPrefixLenArgType = int64 +type UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType = int64 + +func getUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(arg UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType) (ret UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType(arg *UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType, val UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for maxPrefixLen +*/ + +// isLong +type UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType = *int64 +type UpdateRegionalAreaIPv4GetMaxPrefixLenArgType = int64 +type UpdateRegionalAreaIPv4GetMaxPrefixLenRetType = int64 + +func getUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(arg UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType) (ret UpdateRegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType(arg *UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType, val UpdateRegionalAreaIPv4GetMaxPrefixLenRetType) { + *arg = &val +} + +/* + types and functions for minPrefixLen +*/ + +// isLong +type UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType = *int64 +type UpdateRegionalAreaIPv4GetMinPrefixLenArgType = int64 +type UpdateRegionalAreaIPv4GetMinPrefixLenRetType = int64 + +func getUpdateRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(arg UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType) (ret UpdateRegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRegionalAreaIPv4GetMinPrefixLenAttributeType(arg *UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType, val UpdateRegionalAreaIPv4GetMinPrefixLenRetType) { + *arg = &val +} + +// UpdateRegionalAreaIPv4 Object that represents the request body for a regional network area IPv4 configuration update. +type UpdateRegionalAreaIPv4 struct { + DefaultNameservers UpdateRegionalAreaIPv4GetDefaultNameserversAttributeType `json:"defaultNameservers,omitempty"` + // The default prefix length for networks in the network area. + DefaultPrefixLen UpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType `json:"defaultPrefixLen,omitempty"` + // The maximal prefix length for networks in the network area. + MaxPrefixLen UpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType `json:"maxPrefixLen,omitempty"` + // The minimal prefix length for networks in the network area. + MinPrefixLen UpdateRegionalAreaIPv4GetMinPrefixLenAttributeType `json:"minPrefixLen,omitempty"` +} + +// NewUpdateRegionalAreaIPv4 instantiates a new UpdateRegionalAreaIPv4 object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateRegionalAreaIPv4() *UpdateRegionalAreaIPv4 { + this := UpdateRegionalAreaIPv4{} + return &this +} + +// NewUpdateRegionalAreaIPv4WithDefaults instantiates a new UpdateRegionalAreaIPv4 object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateRegionalAreaIPv4WithDefaults() *UpdateRegionalAreaIPv4 { + this := UpdateRegionalAreaIPv4{} + return &this +} + +// GetDefaultNameservers returns the DefaultNameservers field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetDefaultNameservers() (res UpdateRegionalAreaIPv4GetDefaultNameserversRetType) { + res, _ = o.GetDefaultNameserversOk() + return +} + +// GetDefaultNameserversOk returns a tuple with the DefaultNameservers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetDefaultNameserversOk() (ret UpdateRegionalAreaIPv4GetDefaultNameserversRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers) +} + +// HasDefaultNameservers returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasDefaultNameservers() bool { + _, ok := o.GetDefaultNameserversOk() + return ok +} + +// SetDefaultNameservers gets a reference to the given []string and assigns it to the DefaultNameservers field. +func (o *UpdateRegionalAreaIPv4) SetDefaultNameservers(v UpdateRegionalAreaIPv4GetDefaultNameserversRetType) { + setUpdateRegionalAreaIPv4GetDefaultNameserversAttributeType(&o.DefaultNameservers, v) +} + +// GetDefaultPrefixLen returns the DefaultPrefixLen field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetDefaultPrefixLen() (res UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType) { + res, _ = o.GetDefaultPrefixLenOk() + return +} + +// GetDefaultPrefixLenOk returns a tuple with the DefaultPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetDefaultPrefixLenOk() (ret UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen) +} + +// HasDefaultPrefixLen returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasDefaultPrefixLen() bool { + _, ok := o.GetDefaultPrefixLenOk() + return ok +} + +// SetDefaultPrefixLen gets a reference to the given int64 and assigns it to the DefaultPrefixLen field. +func (o *UpdateRegionalAreaIPv4) SetDefaultPrefixLen(v UpdateRegionalAreaIPv4GetDefaultPrefixLenRetType) { + setUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeType(&o.DefaultPrefixLen, v) +} + +// GetMaxPrefixLen returns the MaxPrefixLen field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetMaxPrefixLen() (res UpdateRegionalAreaIPv4GetMaxPrefixLenRetType) { + res, _ = o.GetMaxPrefixLenOk() + return +} + +// GetMaxPrefixLenOk returns a tuple with the MaxPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetMaxPrefixLenOk() (ret UpdateRegionalAreaIPv4GetMaxPrefixLenRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen) +} + +// HasMaxPrefixLen returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasMaxPrefixLen() bool { + _, ok := o.GetMaxPrefixLenOk() + return ok +} + +// SetMaxPrefixLen gets a reference to the given int64 and assigns it to the MaxPrefixLen field. +func (o *UpdateRegionalAreaIPv4) SetMaxPrefixLen(v UpdateRegionalAreaIPv4GetMaxPrefixLenRetType) { + setUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeType(&o.MaxPrefixLen, v) +} + +// GetMinPrefixLen returns the MinPrefixLen field value if set, zero value otherwise. +func (o *UpdateRegionalAreaIPv4) GetMinPrefixLen() (res UpdateRegionalAreaIPv4GetMinPrefixLenRetType) { + res, _ = o.GetMinPrefixLenOk() + return +} + +// GetMinPrefixLenOk returns a tuple with the MinPrefixLen field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRegionalAreaIPv4) GetMinPrefixLenOk() (ret UpdateRegionalAreaIPv4GetMinPrefixLenRetType, ok bool) { + return getUpdateRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen) +} + +// HasMinPrefixLen returns a boolean if a field has been set. +func (o *UpdateRegionalAreaIPv4) HasMinPrefixLen() bool { + _, ok := o.GetMinPrefixLenOk() + return ok +} + +// SetMinPrefixLen gets a reference to the given int64 and assigns it to the MinPrefixLen field. +func (o *UpdateRegionalAreaIPv4) SetMinPrefixLen(v UpdateRegionalAreaIPv4GetMinPrefixLenRetType) { + setUpdateRegionalAreaIPv4GetMinPrefixLenAttributeType(&o.MinPrefixLen, v) +} + +func (o UpdateRegionalAreaIPv4) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRegionalAreaIPv4GetDefaultNameserversAttributeTypeOk(o.DefaultNameservers); ok { + toSerialize["DefaultNameservers"] = val + } + if val, ok := getUpdateRegionalAreaIPv4GetDefaultPrefixLenAttributeTypeOk(o.DefaultPrefixLen); ok { + toSerialize["DefaultPrefixLen"] = val + } + if val, ok := getUpdateRegionalAreaIPv4GetMaxPrefixLenAttributeTypeOk(o.MaxPrefixLen); ok { + toSerialize["MaxPrefixLen"] = val + } + if val, ok := getUpdateRegionalAreaIPv4GetMinPrefixLenAttributeTypeOk(o.MinPrefixLen); ok { + toSerialize["MinPrefixLen"] = val + } + return toSerialize, nil +} + +type NullableUpdateRegionalAreaIPv4 struct { + value *UpdateRegionalAreaIPv4 + isSet bool +} + +func (v NullableUpdateRegionalAreaIPv4) Get() *UpdateRegionalAreaIPv4 { + return v.value +} + +func (v *NullableUpdateRegionalAreaIPv4) Set(val *UpdateRegionalAreaIPv4) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRegionalAreaIPv4) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRegionalAreaIPv4) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRegionalAreaIPv4(val *UpdateRegionalAreaIPv4) *NullableUpdateRegionalAreaIPv4 { + return &NullableUpdateRegionalAreaIPv4{value: val, isSet: true} +} + +func (v NullableUpdateRegionalAreaIPv4) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRegionalAreaIPv4) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_route_of_routing_table_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_route_of_routing_table_payload.go new file mode 100644 index 00000000..9d743157 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_route_of_routing_table_payload.go @@ -0,0 +1,128 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateRouteOfRoutingTablePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRouteOfRoutingTablePayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateRouteOfRoutingTablePayloadGetLabelsArgType = map[string]interface{} +type UpdateRouteOfRoutingTablePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(arg UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType) (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(arg *UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType, val UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + *arg = &val +} + +// UpdateRouteOfRoutingTablePayload Object that represents the request body for a route update. +type UpdateRouteOfRoutingTablePayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateRouteOfRoutingTablePayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +// NewUpdateRouteOfRoutingTablePayload instantiates a new UpdateRouteOfRoutingTablePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateRouteOfRoutingTablePayload() *UpdateRouteOfRoutingTablePayload { + this := UpdateRouteOfRoutingTablePayload{} + return &this +} + +// NewUpdateRouteOfRoutingTablePayloadWithDefaults instantiates a new UpdateRouteOfRoutingTablePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateRouteOfRoutingTablePayloadWithDefaults() *UpdateRouteOfRoutingTablePayload { + this := UpdateRouteOfRoutingTablePayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateRouteOfRoutingTablePayload) GetLabels() (res UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRouteOfRoutingTablePayload) GetLabelsOk() (ret UpdateRouteOfRoutingTablePayloadGetLabelsRetType, ok bool) { + return getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateRouteOfRoutingTablePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateRouteOfRoutingTablePayload) SetLabels(v UpdateRouteOfRoutingTablePayloadGetLabelsRetType) { + setUpdateRouteOfRoutingTablePayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateRouteOfRoutingTablePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRouteOfRoutingTablePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateRouteOfRoutingTablePayload struct { + value *UpdateRouteOfRoutingTablePayload + isSet bool +} + +func (v NullableUpdateRouteOfRoutingTablePayload) Get() *UpdateRouteOfRoutingTablePayload { + return v.value +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) Set(val *UpdateRouteOfRoutingTablePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRouteOfRoutingTablePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRouteOfRoutingTablePayload(val *UpdateRouteOfRoutingTablePayload) *NullableUpdateRouteOfRoutingTablePayload { + return &NullableUpdateRouteOfRoutingTablePayload{value: val, isSet: true} +} + +func (v NullableUpdateRouteOfRoutingTablePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRouteOfRoutingTablePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_routing_table_of_area_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_routing_table_of_area_payload.go new file mode 100644 index 00000000..8ef54bd1 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_routing_table_of_area_payload.go @@ -0,0 +1,276 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateRoutingTableOfAreaPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateRoutingTableOfAreaPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType = *string + +func getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType, val UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateRoutingTableOfAreaPayloadGetDescriptionArgType = string +type UpdateRoutingTableOfAreaPayloadGetDescriptionRetType = string + +/* + types and functions for dynamicRoutes +*/ + +// isBoolean +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType = *bool +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesArgType = bool +type UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType = bool + +func getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType) (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(arg *UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType, val UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateRoutingTableOfAreaPayloadGetLabelsArgType = map[string]interface{} +type UpdateRoutingTableOfAreaPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType, val UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateRoutingTableOfAreaPayloadGetNameAttributeType = *string + +func getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(arg UpdateRoutingTableOfAreaPayloadGetNameAttributeType) (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(arg *UpdateRoutingTableOfAreaPayloadGetNameAttributeType, val UpdateRoutingTableOfAreaPayloadGetNameRetType) { + *arg = &val +} + +type UpdateRoutingTableOfAreaPayloadGetNameArgType = string +type UpdateRoutingTableOfAreaPayloadGetNameRetType = string + +// UpdateRoutingTableOfAreaPayload Object that represents the request body for a routing table update. +type UpdateRoutingTableOfAreaPayload struct { + // Description Object. Allows string up to 255 Characters. + Description UpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // A config setting for a routing table which allows propagation of dynamic routes to this routing table. + DynamicRoutes UpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType `json:"dynamicRoutes,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateRoutingTableOfAreaPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateRoutingTableOfAreaPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewUpdateRoutingTableOfAreaPayload instantiates a new UpdateRoutingTableOfAreaPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateRoutingTableOfAreaPayload() *UpdateRoutingTableOfAreaPayload { + this := UpdateRoutingTableOfAreaPayload{} + return &this +} + +// NewUpdateRoutingTableOfAreaPayloadWithDefaults instantiates a new UpdateRoutingTableOfAreaPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateRoutingTableOfAreaPayloadWithDefaults() *UpdateRoutingTableOfAreaPayload { + this := UpdateRoutingTableOfAreaPayload{} + var dynamicRoutes bool = true + this.DynamicRoutes = &dynamicRoutes + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetDescription() (res UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetDescriptionOk() (ret UpdateRoutingTableOfAreaPayloadGetDescriptionRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateRoutingTableOfAreaPayload) SetDescription(v UpdateRoutingTableOfAreaPayloadGetDescriptionRetType) { + setUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetDynamicRoutes returns the DynamicRoutes field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutes() (res UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + res, _ = o.GetDynamicRoutesOk() + return +} + +// GetDynamicRoutesOk returns a tuple with the DynamicRoutes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetDynamicRoutesOk() (ret UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes) +} + +// HasDynamicRoutes returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasDynamicRoutes() bool { + _, ok := o.GetDynamicRoutesOk() + return ok +} + +// SetDynamicRoutes gets a reference to the given bool and assigns it to the DynamicRoutes field. +func (o *UpdateRoutingTableOfAreaPayload) SetDynamicRoutes(v UpdateRoutingTableOfAreaPayloadgetDynamicRoutesRetType) { + setUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeType(&o.DynamicRoutes, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetLabels() (res UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetLabelsOk() (ret UpdateRoutingTableOfAreaPayloadGetLabelsRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateRoutingTableOfAreaPayload) SetLabels(v UpdateRoutingTableOfAreaPayloadGetLabelsRetType) { + setUpdateRoutingTableOfAreaPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateRoutingTableOfAreaPayload) GetName() (res UpdateRoutingTableOfAreaPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateRoutingTableOfAreaPayload) GetNameOk() (ret UpdateRoutingTableOfAreaPayloadGetNameRetType, ok bool) { + return getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateRoutingTableOfAreaPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateRoutingTableOfAreaPayload) SetName(v UpdateRoutingTableOfAreaPayloadGetNameRetType) { + setUpdateRoutingTableOfAreaPayloadGetNameAttributeType(&o.Name, v) +} + +func (o UpdateRoutingTableOfAreaPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateRoutingTableOfAreaPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadgetDynamicRoutesAttributeTypeOk(o.DynamicRoutes); ok { + toSerialize["DynamicRoutes"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateRoutingTableOfAreaPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableUpdateRoutingTableOfAreaPayload struct { + value *UpdateRoutingTableOfAreaPayload + isSet bool +} + +func (v NullableUpdateRoutingTableOfAreaPayload) Get() *UpdateRoutingTableOfAreaPayload { + return v.value +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) Set(val *UpdateRoutingTableOfAreaPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateRoutingTableOfAreaPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateRoutingTableOfAreaPayload(val *UpdateRoutingTableOfAreaPayload) *NullableUpdateRoutingTableOfAreaPayload { + return &NullableUpdateRoutingTableOfAreaPayload{value: val, isSet: true} +} + +func (v NullableUpdateRoutingTableOfAreaPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateRoutingTableOfAreaPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_security_group_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_security_group_payload.go new file mode 100644 index 00000000..8bc1db9e --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_security_group_payload.go @@ -0,0 +1,226 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateSecurityGroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSecurityGroupPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateSecurityGroupPayloadGetDescriptionAttributeType = *string + +func getUpdateSecurityGroupPayloadGetDescriptionAttributeTypeOk(arg UpdateSecurityGroupPayloadGetDescriptionAttributeType) (ret UpdateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateSecurityGroupPayloadGetDescriptionAttributeType(arg *UpdateSecurityGroupPayloadGetDescriptionAttributeType, val UpdateSecurityGroupPayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateSecurityGroupPayloadGetDescriptionArgType = string +type UpdateSecurityGroupPayloadGetDescriptionRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateSecurityGroupPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateSecurityGroupPayloadGetLabelsArgType = map[string]interface{} +type UpdateSecurityGroupPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateSecurityGroupPayloadGetLabelsAttributeTypeOk(arg UpdateSecurityGroupPayloadGetLabelsAttributeType) (ret UpdateSecurityGroupPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateSecurityGroupPayloadGetLabelsAttributeType(arg *UpdateSecurityGroupPayloadGetLabelsAttributeType, val UpdateSecurityGroupPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateSecurityGroupPayloadGetNameAttributeType = *string + +func getUpdateSecurityGroupPayloadGetNameAttributeTypeOk(arg UpdateSecurityGroupPayloadGetNameAttributeType) (ret UpdateSecurityGroupPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateSecurityGroupPayloadGetNameAttributeType(arg *UpdateSecurityGroupPayloadGetNameAttributeType, val UpdateSecurityGroupPayloadGetNameRetType) { + *arg = &val +} + +type UpdateSecurityGroupPayloadGetNameArgType = string +type UpdateSecurityGroupPayloadGetNameRetType = string + +// UpdateSecurityGroupPayload Object that represents an update request body of a security group. +type UpdateSecurityGroupPayload struct { + // Description Object. Allows string up to 255 Characters. + Description UpdateSecurityGroupPayloadGetDescriptionAttributeType `json:"description,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateSecurityGroupPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateSecurityGroupPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewUpdateSecurityGroupPayload instantiates a new UpdateSecurityGroupPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateSecurityGroupPayload() *UpdateSecurityGroupPayload { + this := UpdateSecurityGroupPayload{} + return &this +} + +// NewUpdateSecurityGroupPayloadWithDefaults instantiates a new UpdateSecurityGroupPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateSecurityGroupPayloadWithDefaults() *UpdateSecurityGroupPayload { + this := UpdateSecurityGroupPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateSecurityGroupPayload) GetDescription() (res UpdateSecurityGroupPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSecurityGroupPayload) GetDescriptionOk() (ret UpdateSecurityGroupPayloadGetDescriptionRetType, ok bool) { + return getUpdateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateSecurityGroupPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateSecurityGroupPayload) SetDescription(v UpdateSecurityGroupPayloadGetDescriptionRetType) { + setUpdateSecurityGroupPayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateSecurityGroupPayload) GetLabels() (res UpdateSecurityGroupPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSecurityGroupPayload) GetLabelsOk() (ret UpdateSecurityGroupPayloadGetLabelsRetType, ok bool) { + return getUpdateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateSecurityGroupPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateSecurityGroupPayload) SetLabels(v UpdateSecurityGroupPayloadGetLabelsRetType) { + setUpdateSecurityGroupPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateSecurityGroupPayload) GetName() (res UpdateSecurityGroupPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSecurityGroupPayload) GetNameOk() (ret UpdateSecurityGroupPayloadGetNameRetType, ok bool) { + return getUpdateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateSecurityGroupPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateSecurityGroupPayload) SetName(v UpdateSecurityGroupPayloadGetNameRetType) { + setUpdateSecurityGroupPayloadGetNameAttributeType(&o.Name, v) +} + +func (o UpdateSecurityGroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateSecurityGroupPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateSecurityGroupPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateSecurityGroupPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableUpdateSecurityGroupPayload struct { + value *UpdateSecurityGroupPayload + isSet bool +} + +func (v NullableUpdateSecurityGroupPayload) Get() *UpdateSecurityGroupPayload { + return v.value +} + +func (v *NullableUpdateSecurityGroupPayload) Set(val *UpdateSecurityGroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateSecurityGroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateSecurityGroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateSecurityGroupPayload(val *UpdateSecurityGroupPayload) *NullableUpdateSecurityGroupPayload { + return &NullableUpdateSecurityGroupPayload{value: val, isSet: true} +} + +func (v NullableUpdateSecurityGroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateSecurityGroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_server_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_server_payload.go new file mode 100644 index 00000000..9362cbce --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_server_payload.go @@ -0,0 +1,225 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateServerPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateServerPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateServerPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateServerPayloadGetLabelsArgType = map[string]interface{} +type UpdateServerPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateServerPayloadGetLabelsAttributeTypeOk(arg UpdateServerPayloadGetLabelsAttributeType) (ret UpdateServerPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateServerPayloadGetLabelsAttributeType(arg *UpdateServerPayloadGetLabelsAttributeType, val UpdateServerPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for metadata +*/ + +// isFreeform +type UpdateServerPayloadGetMetadataAttributeType = *map[string]interface{} +type UpdateServerPayloadGetMetadataArgType = map[string]interface{} +type UpdateServerPayloadGetMetadataRetType = map[string]interface{} + +func getUpdateServerPayloadGetMetadataAttributeTypeOk(arg UpdateServerPayloadGetMetadataAttributeType) (ret UpdateServerPayloadGetMetadataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateServerPayloadGetMetadataAttributeType(arg *UpdateServerPayloadGetMetadataAttributeType, val UpdateServerPayloadGetMetadataRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateServerPayloadGetNameAttributeType = *string + +func getUpdateServerPayloadGetNameAttributeTypeOk(arg UpdateServerPayloadGetNameAttributeType) (ret UpdateServerPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateServerPayloadGetNameAttributeType(arg *UpdateServerPayloadGetNameAttributeType, val UpdateServerPayloadGetNameRetType) { + *arg = &val +} + +type UpdateServerPayloadGetNameArgType = string +type UpdateServerPayloadGetNameRetType = string + +// UpdateServerPayload Object that represents an update request body of a server. +type UpdateServerPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateServerPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // Object that represents the metadata of an object. Regex for keys: `^[a-zA-Z0-9-_:. ]{1,255}$`. Regex for values: `^.{0,255}$`. Providing a `null` value for a key will remove that key. + Metadata UpdateServerPayloadGetMetadataAttributeType `json:"metadata,omitempty"` + // The name for a Server. + Name UpdateServerPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewUpdateServerPayload instantiates a new UpdateServerPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateServerPayload() *UpdateServerPayload { + this := UpdateServerPayload{} + return &this +} + +// NewUpdateServerPayloadWithDefaults instantiates a new UpdateServerPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateServerPayloadWithDefaults() *UpdateServerPayload { + this := UpdateServerPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateServerPayload) GetLabels() (res UpdateServerPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateServerPayload) GetLabelsOk() (ret UpdateServerPayloadGetLabelsRetType, ok bool) { + return getUpdateServerPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateServerPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateServerPayload) SetLabels(v UpdateServerPayloadGetLabelsRetType) { + setUpdateServerPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *UpdateServerPayload) GetMetadata() (res UpdateServerPayloadGetMetadataRetType) { + res, _ = o.GetMetadataOk() + return +} + +// GetMetadataOk returns a tuple with the Metadata field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateServerPayload) GetMetadataOk() (ret UpdateServerPayloadGetMetadataRetType, ok bool) { + return getUpdateServerPayloadGetMetadataAttributeTypeOk(o.Metadata) +} + +// HasMetadata returns a boolean if a field has been set. +func (o *UpdateServerPayload) HasMetadata() bool { + _, ok := o.GetMetadataOk() + return ok +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *UpdateServerPayload) SetMetadata(v UpdateServerPayloadGetMetadataRetType) { + setUpdateServerPayloadGetMetadataAttributeType(&o.Metadata, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateServerPayload) GetName() (res UpdateServerPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateServerPayload) GetNameOk() (ret UpdateServerPayloadGetNameRetType, ok bool) { + return getUpdateServerPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateServerPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateServerPayload) SetName(v UpdateServerPayloadGetNameRetType) { + setUpdateServerPayloadGetNameAttributeType(&o.Name, v) +} + +func (o UpdateServerPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateServerPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateServerPayloadGetMetadataAttributeTypeOk(o.Metadata); ok { + toSerialize["Metadata"] = val + } + if val, ok := getUpdateServerPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableUpdateServerPayload struct { + value *UpdateServerPayload + isSet bool +} + +func (v NullableUpdateServerPayload) Get() *UpdateServerPayload { + return v.value +} + +func (v *NullableUpdateServerPayload) Set(val *UpdateServerPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateServerPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateServerPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateServerPayload(val *UpdateServerPayload) *NullableUpdateServerPayload { + return &NullableUpdateServerPayload{value: val, isSet: true} +} + +func (v NullableUpdateServerPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateServerPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_snapshot_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_snapshot_payload.go new file mode 100644 index 00000000..d758b4dd --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_snapshot_payload.go @@ -0,0 +1,177 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateSnapshotPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateSnapshotPayload{} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateSnapshotPayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateSnapshotPayloadGetLabelsArgType = map[string]interface{} +type UpdateSnapshotPayloadGetLabelsRetType = map[string]interface{} + +func getUpdateSnapshotPayloadGetLabelsAttributeTypeOk(arg UpdateSnapshotPayloadGetLabelsAttributeType) (ret UpdateSnapshotPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateSnapshotPayloadGetLabelsAttributeType(arg *UpdateSnapshotPayloadGetLabelsAttributeType, val UpdateSnapshotPayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateSnapshotPayloadGetNameAttributeType = *string + +func getUpdateSnapshotPayloadGetNameAttributeTypeOk(arg UpdateSnapshotPayloadGetNameAttributeType) (ret UpdateSnapshotPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateSnapshotPayloadGetNameAttributeType(arg *UpdateSnapshotPayloadGetNameAttributeType, val UpdateSnapshotPayloadGetNameRetType) { + *arg = &val +} + +type UpdateSnapshotPayloadGetNameArgType = string +type UpdateSnapshotPayloadGetNameRetType = string + +// UpdateSnapshotPayload Object that represents an update request body of a snapshot. +type UpdateSnapshotPayload struct { + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateSnapshotPayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateSnapshotPayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewUpdateSnapshotPayload instantiates a new UpdateSnapshotPayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateSnapshotPayload() *UpdateSnapshotPayload { + this := UpdateSnapshotPayload{} + return &this +} + +// NewUpdateSnapshotPayloadWithDefaults instantiates a new UpdateSnapshotPayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateSnapshotPayloadWithDefaults() *UpdateSnapshotPayload { + this := UpdateSnapshotPayload{} + return &this +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateSnapshotPayload) GetLabels() (res UpdateSnapshotPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSnapshotPayload) GetLabelsOk() (ret UpdateSnapshotPayloadGetLabelsRetType, ok bool) { + return getUpdateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateSnapshotPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateSnapshotPayload) SetLabels(v UpdateSnapshotPayloadGetLabelsRetType) { + setUpdateSnapshotPayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateSnapshotPayload) GetName() (res UpdateSnapshotPayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateSnapshotPayload) GetNameOk() (ret UpdateSnapshotPayloadGetNameRetType, ok bool) { + return getUpdateSnapshotPayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateSnapshotPayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateSnapshotPayload) SetName(v UpdateSnapshotPayloadGetNameRetType) { + setUpdateSnapshotPayloadGetNameAttributeType(&o.Name, v) +} + +func (o UpdateSnapshotPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateSnapshotPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateSnapshotPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableUpdateSnapshotPayload struct { + value *UpdateSnapshotPayload + isSet bool +} + +func (v NullableUpdateSnapshotPayload) Get() *UpdateSnapshotPayload { + return v.value +} + +func (v *NullableUpdateSnapshotPayload) Set(val *UpdateSnapshotPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateSnapshotPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateSnapshotPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateSnapshotPayload(val *UpdateSnapshotPayload) *NullableUpdateSnapshotPayload { + return &NullableUpdateSnapshotPayload{value: val, isSet: true} +} + +func (v NullableUpdateSnapshotPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateSnapshotPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_volume_payload.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_volume_payload.go new file mode 100644 index 00000000..cdd6183f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_update_volume_payload.go @@ -0,0 +1,321 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the UpdateVolumePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateVolumePayload{} + +/* + types and functions for bootable +*/ + +// isBoolean +type UpdateVolumePayloadgetBootableAttributeType = *bool +type UpdateVolumePayloadgetBootableArgType = bool +type UpdateVolumePayloadgetBootableRetType = bool + +func getUpdateVolumePayloadgetBootableAttributeTypeOk(arg UpdateVolumePayloadgetBootableAttributeType) (ret UpdateVolumePayloadgetBootableRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadgetBootableAttributeType(arg *UpdateVolumePayloadgetBootableAttributeType, val UpdateVolumePayloadgetBootableRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type UpdateVolumePayloadGetDescriptionAttributeType = *string + +func getUpdateVolumePayloadGetDescriptionAttributeTypeOk(arg UpdateVolumePayloadGetDescriptionAttributeType) (ret UpdateVolumePayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetDescriptionAttributeType(arg *UpdateVolumePayloadGetDescriptionAttributeType, val UpdateVolumePayloadGetDescriptionRetType) { + *arg = &val +} + +type UpdateVolumePayloadGetDescriptionArgType = string +type UpdateVolumePayloadGetDescriptionRetType = string + +/* + types and functions for imageConfig +*/ + +// isModel +type UpdateVolumePayloadGetImageConfigAttributeType = *ImageConfig +type UpdateVolumePayloadGetImageConfigArgType = ImageConfig +type UpdateVolumePayloadGetImageConfigRetType = ImageConfig + +func getUpdateVolumePayloadGetImageConfigAttributeTypeOk(arg UpdateVolumePayloadGetImageConfigAttributeType) (ret UpdateVolumePayloadGetImageConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetImageConfigAttributeType(arg *UpdateVolumePayloadGetImageConfigAttributeType, val UpdateVolumePayloadGetImageConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateVolumePayloadGetLabelsAttributeType = *map[string]interface{} +type UpdateVolumePayloadGetLabelsArgType = map[string]interface{} +type UpdateVolumePayloadGetLabelsRetType = map[string]interface{} + +func getUpdateVolumePayloadGetLabelsAttributeTypeOk(arg UpdateVolumePayloadGetLabelsAttributeType) (ret UpdateVolumePayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetLabelsAttributeType(arg *UpdateVolumePayloadGetLabelsAttributeType, val UpdateVolumePayloadGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateVolumePayloadGetNameAttributeType = *string + +func getUpdateVolumePayloadGetNameAttributeTypeOk(arg UpdateVolumePayloadGetNameAttributeType) (ret UpdateVolumePayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateVolumePayloadGetNameAttributeType(arg *UpdateVolumePayloadGetNameAttributeType, val UpdateVolumePayloadGetNameRetType) { + *arg = &val +} + +type UpdateVolumePayloadGetNameArgType = string +type UpdateVolumePayloadGetNameRetType = string + +// UpdateVolumePayload Object that represents an update request body of a volume. +type UpdateVolumePayload struct { + // Indicates if a volume is bootable. + Bootable UpdateVolumePayloadgetBootableAttributeType `json:"bootable,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description UpdateVolumePayloadGetDescriptionAttributeType `json:"description,omitempty"` + ImageConfig UpdateVolumePayloadGetImageConfigAttributeType `json:"imageConfig,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels UpdateVolumePayloadGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name UpdateVolumePayloadGetNameAttributeType `json:"name,omitempty"` +} + +// NewUpdateVolumePayload instantiates a new UpdateVolumePayload object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewUpdateVolumePayload() *UpdateVolumePayload { + this := UpdateVolumePayload{} + return &this +} + +// NewUpdateVolumePayloadWithDefaults instantiates a new UpdateVolumePayload object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewUpdateVolumePayloadWithDefaults() *UpdateVolumePayload { + this := UpdateVolumePayload{} + return &this +} + +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetBootable() (res UpdateVolumePayloadgetBootableRetType) { + res, _ = o.GetBootableOk() + return +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetBootableOk() (ret UpdateVolumePayloadgetBootableRetType, ok bool) { + return getUpdateVolumePayloadgetBootableAttributeTypeOk(o.Bootable) +} + +// HasBootable returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasBootable() bool { + _, ok := o.GetBootableOk() + return ok +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *UpdateVolumePayload) SetBootable(v UpdateVolumePayloadgetBootableRetType) { + setUpdateVolumePayloadgetBootableAttributeType(&o.Bootable, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetDescription() (res UpdateVolumePayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetDescriptionOk() (ret UpdateVolumePayloadGetDescriptionRetType, ok bool) { + return getUpdateVolumePayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateVolumePayload) SetDescription(v UpdateVolumePayloadGetDescriptionRetType) { + setUpdateVolumePayloadGetDescriptionAttributeType(&o.Description, v) +} + +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetImageConfig() (res UpdateVolumePayloadGetImageConfigRetType) { + res, _ = o.GetImageConfigOk() + return +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetImageConfigOk() (ret UpdateVolumePayloadGetImageConfigRetType, ok bool) { + return getUpdateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig) +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasImageConfig() bool { + _, ok := o.GetImageConfigOk() + return ok +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *UpdateVolumePayload) SetImageConfig(v UpdateVolumePayloadGetImageConfigRetType) { + setUpdateVolumePayloadGetImageConfigAttributeType(&o.ImageConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetLabels() (res UpdateVolumePayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetLabelsOk() (ret UpdateVolumePayloadGetLabelsRetType, ok bool) { + return getUpdateVolumePayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateVolumePayload) SetLabels(v UpdateVolumePayloadGetLabelsRetType) { + setUpdateVolumePayloadGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *UpdateVolumePayload) GetName() (res UpdateVolumePayloadGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateVolumePayload) GetNameOk() (ret UpdateVolumePayloadGetNameRetType, ok bool) { + return getUpdateVolumePayloadGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateVolumePayload) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *UpdateVolumePayload) SetName(v UpdateVolumePayloadGetNameRetType) { + setUpdateVolumePayloadGetNameAttributeType(&o.Name, v) +} + +func (o UpdateVolumePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateVolumePayloadgetBootableAttributeTypeOk(o.Bootable); ok { + toSerialize["Bootable"] = val + } + if val, ok := getUpdateVolumePayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getUpdateVolumePayloadGetImageConfigAttributeTypeOk(o.ImageConfig); ok { + toSerialize["ImageConfig"] = val + } + if val, ok := getUpdateVolumePayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getUpdateVolumePayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + return toSerialize, nil +} + +type NullableUpdateVolumePayload struct { + value *UpdateVolumePayload + isSet bool +} + +func (v NullableUpdateVolumePayload) Get() *UpdateVolumePayload { + return v.value +} + +func (v *NullableUpdateVolumePayload) Set(val *UpdateVolumePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateVolumePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateVolumePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateVolumePayload(val *UpdateVolumePayload) *NullableUpdateVolumePayload { + return &NullableUpdateVolumePayload{value: val, isSet: true} +} + +func (v NullableUpdateVolumePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateVolumePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume.go new file mode 100644 index 00000000..db82e064 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume.go @@ -0,0 +1,851 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "time" +) + +// checks if the Volume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volume{} + +/* + types and functions for availabilityZone +*/ + +// isNotNullableString +type VolumeGetAvailabilityZoneAttributeType = *string + +func getVolumeGetAvailabilityZoneAttributeTypeOk(arg VolumeGetAvailabilityZoneAttributeType) (ret VolumeGetAvailabilityZoneRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetAvailabilityZoneAttributeType(arg *VolumeGetAvailabilityZoneAttributeType, val VolumeGetAvailabilityZoneRetType) { + *arg = &val +} + +type VolumeGetAvailabilityZoneArgType = string +type VolumeGetAvailabilityZoneRetType = string + +/* + types and functions for bootable +*/ + +// isBoolean +type VolumegetBootableAttributeType = *bool +type VolumegetBootableArgType = bool +type VolumegetBootableRetType = bool + +func getVolumegetBootableAttributeTypeOk(arg VolumegetBootableAttributeType) (ret VolumegetBootableRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumegetBootableAttributeType(arg *VolumegetBootableAttributeType, val VolumegetBootableRetType) { + *arg = &val +} + +/* + types and functions for createdAt +*/ + +// isDateTime +type VolumeGetCreatedAtAttributeType = *time.Time +type VolumeGetCreatedAtArgType = time.Time +type VolumeGetCreatedAtRetType = time.Time + +func getVolumeGetCreatedAtAttributeTypeOk(arg VolumeGetCreatedAtAttributeType) (ret VolumeGetCreatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetCreatedAtAttributeType(arg *VolumeGetCreatedAtAttributeType, val VolumeGetCreatedAtRetType) { + *arg = &val +} + +/* + types and functions for description +*/ + +// isNotNullableString +type VolumeGetDescriptionAttributeType = *string + +func getVolumeGetDescriptionAttributeTypeOk(arg VolumeGetDescriptionAttributeType) (ret VolumeGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetDescriptionAttributeType(arg *VolumeGetDescriptionAttributeType, val VolumeGetDescriptionRetType) { + *arg = &val +} + +type VolumeGetDescriptionArgType = string +type VolumeGetDescriptionRetType = string + +/* + types and functions for encrypted +*/ + +// isBoolean +type VolumegetEncryptedAttributeType = *bool +type VolumegetEncryptedArgType = bool +type VolumegetEncryptedRetType = bool + +func getVolumegetEncryptedAttributeTypeOk(arg VolumegetEncryptedAttributeType) (ret VolumegetEncryptedRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumegetEncryptedAttributeType(arg *VolumegetEncryptedAttributeType, val VolumegetEncryptedRetType) { + *arg = &val +} + +/* + types and functions for encryptionParameters +*/ + +// isModel +type VolumeGetEncryptionParametersAttributeType = *VolumeEncryptionParameter +type VolumeGetEncryptionParametersArgType = VolumeEncryptionParameter +type VolumeGetEncryptionParametersRetType = VolumeEncryptionParameter + +func getVolumeGetEncryptionParametersAttributeTypeOk(arg VolumeGetEncryptionParametersAttributeType) (ret VolumeGetEncryptionParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetEncryptionParametersAttributeType(arg *VolumeGetEncryptionParametersAttributeType, val VolumeGetEncryptionParametersRetType) { + *arg = &val +} + +/* + types and functions for id +*/ + +// isNotNullableString +type VolumeGetIdAttributeType = *string + +func getVolumeGetIdAttributeTypeOk(arg VolumeGetIdAttributeType) (ret VolumeGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetIdAttributeType(arg *VolumeGetIdAttributeType, val VolumeGetIdRetType) { + *arg = &val +} + +type VolumeGetIdArgType = string +type VolumeGetIdRetType = string + +/* + types and functions for imageConfig +*/ + +// isModel +type VolumeGetImageConfigAttributeType = *ImageConfig +type VolumeGetImageConfigArgType = ImageConfig +type VolumeGetImageConfigRetType = ImageConfig + +func getVolumeGetImageConfigAttributeTypeOk(arg VolumeGetImageConfigAttributeType) (ret VolumeGetImageConfigRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetImageConfigAttributeType(arg *VolumeGetImageConfigAttributeType, val VolumeGetImageConfigRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type VolumeGetLabelsAttributeType = *map[string]interface{} +type VolumeGetLabelsArgType = map[string]interface{} +type VolumeGetLabelsRetType = map[string]interface{} + +func getVolumeGetLabelsAttributeTypeOk(arg VolumeGetLabelsAttributeType) (ret VolumeGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetLabelsAttributeType(arg *VolumeGetLabelsAttributeType, val VolumeGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type VolumeGetNameAttributeType = *string + +func getVolumeGetNameAttributeTypeOk(arg VolumeGetNameAttributeType) (ret VolumeGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetNameAttributeType(arg *VolumeGetNameAttributeType, val VolumeGetNameRetType) { + *arg = &val +} + +type VolumeGetNameArgType = string +type VolumeGetNameRetType = string + +/* + types and functions for performanceClass +*/ + +// isNotNullableString +type VolumeGetPerformanceClassAttributeType = *string + +func getVolumeGetPerformanceClassAttributeTypeOk(arg VolumeGetPerformanceClassAttributeType) (ret VolumeGetPerformanceClassRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetPerformanceClassAttributeType(arg *VolumeGetPerformanceClassAttributeType, val VolumeGetPerformanceClassRetType) { + *arg = &val +} + +type VolumeGetPerformanceClassArgType = string +type VolumeGetPerformanceClassRetType = string + +/* + types and functions for serverId +*/ + +// isNotNullableString +type VolumeGetServerIdAttributeType = *string + +func getVolumeGetServerIdAttributeTypeOk(arg VolumeGetServerIdAttributeType) (ret VolumeGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetServerIdAttributeType(arg *VolumeGetServerIdAttributeType, val VolumeGetServerIdRetType) { + *arg = &val +} + +type VolumeGetServerIdArgType = string +type VolumeGetServerIdRetType = string + +/* + types and functions for size +*/ + +// isLong +type VolumeGetSizeAttributeType = *int64 +type VolumeGetSizeArgType = int64 +type VolumeGetSizeRetType = int64 + +func getVolumeGetSizeAttributeTypeOk(arg VolumeGetSizeAttributeType) (ret VolumeGetSizeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetSizeAttributeType(arg *VolumeGetSizeAttributeType, val VolumeGetSizeRetType) { + *arg = &val +} + +/* + types and functions for source +*/ + +// isModel +type VolumeGetSourceAttributeType = *VolumeSource +type VolumeGetSourceArgType = VolumeSource +type VolumeGetSourceRetType = VolumeSource + +func getVolumeGetSourceAttributeTypeOk(arg VolumeGetSourceAttributeType) (ret VolumeGetSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetSourceAttributeType(arg *VolumeGetSourceAttributeType, val VolumeGetSourceRetType) { + *arg = &val +} + +/* + types and functions for status +*/ + +// isNotNullableString +type VolumeGetStatusAttributeType = *string + +func getVolumeGetStatusAttributeTypeOk(arg VolumeGetStatusAttributeType) (ret VolumeGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetStatusAttributeType(arg *VolumeGetStatusAttributeType, val VolumeGetStatusRetType) { + *arg = &val +} + +type VolumeGetStatusArgType = string +type VolumeGetStatusRetType = string + +/* + types and functions for updatedAt +*/ + +// isDateTime +type VolumeGetUpdatedAtAttributeType = *time.Time +type VolumeGetUpdatedAtArgType = time.Time +type VolumeGetUpdatedAtRetType = time.Time + +func getVolumeGetUpdatedAtAttributeTypeOk(arg VolumeGetUpdatedAtAttributeType) (ret VolumeGetUpdatedAtRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeGetUpdatedAtAttributeType(arg *VolumeGetUpdatedAtAttributeType, val VolumeGetUpdatedAtRetType) { + *arg = &val +} + +// Volume Object that represents a volume and its parameters. Volumes sized up to 16000GB are supported. +type Volume struct { + // Object that represents an availability zone. + // REQUIRED + AvailabilityZone VolumeGetAvailabilityZoneAttributeType `json:"availabilityZone" required:"true"` + // Indicates if a volume is bootable. + Bootable VolumegetBootableAttributeType `json:"bootable,omitempty"` + // Date-time when resource was created. + CreatedAt VolumeGetCreatedAtAttributeType `json:"createdAt,omitempty"` + // Description Object. Allows string up to 255 Characters. + Description VolumeGetDescriptionAttributeType `json:"description,omitempty"` + // Indicates if a volume is encrypted. + Encrypted VolumegetEncryptedAttributeType `json:"encrypted,omitempty"` + EncryptionParameters VolumeGetEncryptionParametersAttributeType `json:"encryptionParameters,omitempty"` + // Universally Unique Identifier (UUID). + Id VolumeGetIdAttributeType `json:"id,omitempty"` + ImageConfig VolumeGetImageConfigAttributeType `json:"imageConfig,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels VolumeGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + Name VolumeGetNameAttributeType `json:"name,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + PerformanceClass VolumeGetPerformanceClassAttributeType `json:"performanceClass,omitempty"` + // Universally Unique Identifier (UUID). + ServerId VolumeGetServerIdAttributeType `json:"serverId,omitempty"` + // Size in Gigabyte. + Size VolumeGetSizeAttributeType `json:"size,omitempty"` + Source VolumeGetSourceAttributeType `json:"source,omitempty"` + // The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `DETACHING`, `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, `MAINTENANCE`, `RESERVED`, `RESIZING`, `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. + Status VolumeGetStatusAttributeType `json:"status,omitempty"` + // Date-time when resource was last updated. + UpdatedAt VolumeGetUpdatedAtAttributeType `json:"updatedAt,omitempty"` +} + +type _Volume Volume + +// NewVolume instantiates a new Volume object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolume(availabilityZone VolumeGetAvailabilityZoneArgType) *Volume { + this := Volume{} + setVolumeGetAvailabilityZoneAttributeType(&this.AvailabilityZone, availabilityZone) + return &this +} + +// NewVolumeWithDefaults instantiates a new Volume object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumeWithDefaults() *Volume { + this := Volume{} + return &this +} + +// GetAvailabilityZone returns the AvailabilityZone field value +func (o *Volume) GetAvailabilityZone() (ret VolumeGetAvailabilityZoneRetType) { + ret, _ = o.GetAvailabilityZoneOk() + return ret +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// and a boolean to check if the value has been set. +func (o *Volume) GetAvailabilityZoneOk() (ret VolumeGetAvailabilityZoneRetType, ok bool) { + return getVolumeGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone) +} + +// SetAvailabilityZone sets field value +func (o *Volume) SetAvailabilityZone(v VolumeGetAvailabilityZoneRetType) { + setVolumeGetAvailabilityZoneAttributeType(&o.AvailabilityZone, v) +} + +// GetBootable returns the Bootable field value if set, zero value otherwise. +func (o *Volume) GetBootable() (res VolumegetBootableRetType) { + res, _ = o.GetBootableOk() + return +} + +// GetBootableOk returns a tuple with the Bootable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetBootableOk() (ret VolumegetBootableRetType, ok bool) { + return getVolumegetBootableAttributeTypeOk(o.Bootable) +} + +// HasBootable returns a boolean if a field has been set. +func (o *Volume) HasBootable() bool { + _, ok := o.GetBootableOk() + return ok +} + +// SetBootable gets a reference to the given bool and assigns it to the Bootable field. +func (o *Volume) SetBootable(v VolumegetBootableRetType) { + setVolumegetBootableAttributeType(&o.Bootable, v) +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *Volume) GetCreatedAt() (res VolumeGetCreatedAtRetType) { + res, _ = o.GetCreatedAtOk() + return +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetCreatedAtOk() (ret VolumeGetCreatedAtRetType, ok bool) { + return getVolumeGetCreatedAtAttributeTypeOk(o.CreatedAt) +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *Volume) HasCreatedAt() bool { + _, ok := o.GetCreatedAtOk() + return ok +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *Volume) SetCreatedAt(v VolumeGetCreatedAtRetType) { + setVolumeGetCreatedAtAttributeType(&o.CreatedAt, v) +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Volume) GetDescription() (res VolumeGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetDescriptionOk() (ret VolumeGetDescriptionRetType, ok bool) { + return getVolumeGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *Volume) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Volume) SetDescription(v VolumeGetDescriptionRetType) { + setVolumeGetDescriptionAttributeType(&o.Description, v) +} + +// GetEncrypted returns the Encrypted field value if set, zero value otherwise. +func (o *Volume) GetEncrypted() (res VolumegetEncryptedRetType) { + res, _ = o.GetEncryptedOk() + return +} + +// GetEncryptedOk returns a tuple with the Encrypted field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetEncryptedOk() (ret VolumegetEncryptedRetType, ok bool) { + return getVolumegetEncryptedAttributeTypeOk(o.Encrypted) +} + +// HasEncrypted returns a boolean if a field has been set. +func (o *Volume) HasEncrypted() bool { + _, ok := o.GetEncryptedOk() + return ok +} + +// SetEncrypted gets a reference to the given bool and assigns it to the Encrypted field. +func (o *Volume) SetEncrypted(v VolumegetEncryptedRetType) { + setVolumegetEncryptedAttributeType(&o.Encrypted, v) +} + +// GetEncryptionParameters returns the EncryptionParameters field value if set, zero value otherwise. +func (o *Volume) GetEncryptionParameters() (res VolumeGetEncryptionParametersRetType) { + res, _ = o.GetEncryptionParametersOk() + return +} + +// GetEncryptionParametersOk returns a tuple with the EncryptionParameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetEncryptionParametersOk() (ret VolumeGetEncryptionParametersRetType, ok bool) { + return getVolumeGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters) +} + +// HasEncryptionParameters returns a boolean if a field has been set. +func (o *Volume) HasEncryptionParameters() bool { + _, ok := o.GetEncryptionParametersOk() + return ok +} + +// SetEncryptionParameters gets a reference to the given VolumeEncryptionParameter and assigns it to the EncryptionParameters field. +func (o *Volume) SetEncryptionParameters(v VolumeGetEncryptionParametersRetType) { + setVolumeGetEncryptionParametersAttributeType(&o.EncryptionParameters, v) +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *Volume) GetId() (res VolumeGetIdRetType) { + res, _ = o.GetIdOk() + return +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetIdOk() (ret VolumeGetIdRetType, ok bool) { + return getVolumeGetIdAttributeTypeOk(o.Id) +} + +// HasId returns a boolean if a field has been set. +func (o *Volume) HasId() bool { + _, ok := o.GetIdOk() + return ok +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Volume) SetId(v VolumeGetIdRetType) { + setVolumeGetIdAttributeType(&o.Id, v) +} + +// GetImageConfig returns the ImageConfig field value if set, zero value otherwise. +func (o *Volume) GetImageConfig() (res VolumeGetImageConfigRetType) { + res, _ = o.GetImageConfigOk() + return +} + +// GetImageConfigOk returns a tuple with the ImageConfig field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetImageConfigOk() (ret VolumeGetImageConfigRetType, ok bool) { + return getVolumeGetImageConfigAttributeTypeOk(o.ImageConfig) +} + +// HasImageConfig returns a boolean if a field has been set. +func (o *Volume) HasImageConfig() bool { + _, ok := o.GetImageConfigOk() + return ok +} + +// SetImageConfig gets a reference to the given ImageConfig and assigns it to the ImageConfig field. +func (o *Volume) SetImageConfig(v VolumeGetImageConfigRetType) { + setVolumeGetImageConfigAttributeType(&o.ImageConfig, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Volume) GetLabels() (res VolumeGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetLabelsOk() (ret VolumeGetLabelsRetType, ok bool) { + return getVolumeGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *Volume) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *Volume) SetLabels(v VolumeGetLabelsRetType) { + setVolumeGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Volume) GetName() (res VolumeGetNameRetType) { + res, _ = o.GetNameOk() + return +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetNameOk() (ret VolumeGetNameRetType, ok bool) { + return getVolumeGetNameAttributeTypeOk(o.Name) +} + +// HasName returns a boolean if a field has been set. +func (o *Volume) HasName() bool { + _, ok := o.GetNameOk() + return ok +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Volume) SetName(v VolumeGetNameRetType) { + setVolumeGetNameAttributeType(&o.Name, v) +} + +// GetPerformanceClass returns the PerformanceClass field value if set, zero value otherwise. +func (o *Volume) GetPerformanceClass() (res VolumeGetPerformanceClassRetType) { + res, _ = o.GetPerformanceClassOk() + return +} + +// GetPerformanceClassOk returns a tuple with the PerformanceClass field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetPerformanceClassOk() (ret VolumeGetPerformanceClassRetType, ok bool) { + return getVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass) +} + +// HasPerformanceClass returns a boolean if a field has been set. +func (o *Volume) HasPerformanceClass() bool { + _, ok := o.GetPerformanceClassOk() + return ok +} + +// SetPerformanceClass gets a reference to the given string and assigns it to the PerformanceClass field. +func (o *Volume) SetPerformanceClass(v VolumeGetPerformanceClassRetType) { + setVolumeGetPerformanceClassAttributeType(&o.PerformanceClass, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *Volume) GetServerId() (res VolumeGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetServerIdOk() (ret VolumeGetServerIdRetType, ok bool) { + return getVolumeGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *Volume) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *Volume) SetServerId(v VolumeGetServerIdRetType) { + setVolumeGetServerIdAttributeType(&o.ServerId, v) +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Volume) GetSize() (res VolumeGetSizeRetType) { + res, _ = o.GetSizeOk() + return +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetSizeOk() (ret VolumeGetSizeRetType, ok bool) { + return getVolumeGetSizeAttributeTypeOk(o.Size) +} + +// HasSize returns a boolean if a field has been set. +func (o *Volume) HasSize() bool { + _, ok := o.GetSizeOk() + return ok +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Volume) SetSize(v VolumeGetSizeRetType) { + setVolumeGetSizeAttributeType(&o.Size, v) +} + +// GetSource returns the Source field value if set, zero value otherwise. +func (o *Volume) GetSource() (res VolumeGetSourceRetType) { + res, _ = o.GetSourceOk() + return +} + +// GetSourceOk returns a tuple with the Source field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetSourceOk() (ret VolumeGetSourceRetType, ok bool) { + return getVolumeGetSourceAttributeTypeOk(o.Source) +} + +// HasSource returns a boolean if a field has been set. +func (o *Volume) HasSource() bool { + _, ok := o.GetSourceOk() + return ok +} + +// SetSource gets a reference to the given VolumeSource and assigns it to the Source field. +func (o *Volume) SetSource(v VolumeGetSourceRetType) { + setVolumeGetSourceAttributeType(&o.Source, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *Volume) GetStatus() (res VolumeGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetStatusOk() (ret VolumeGetStatusRetType, ok bool) { + return getVolumeGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *Volume) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *Volume) SetStatus(v VolumeGetStatusRetType) { + setVolumeGetStatusAttributeType(&o.Status, v) +} + +// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise. +func (o *Volume) GetUpdatedAt() (res VolumeGetUpdatedAtRetType) { + res, _ = o.GetUpdatedAtOk() + return +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Volume) GetUpdatedAtOk() (ret VolumeGetUpdatedAtRetType, ok bool) { + return getVolumeGetUpdatedAtAttributeTypeOk(o.UpdatedAt) +} + +// HasUpdatedAt returns a boolean if a field has been set. +func (o *Volume) HasUpdatedAt() bool { + _, ok := o.GetUpdatedAtOk() + return ok +} + +// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field. +func (o *Volume) SetUpdatedAt(v VolumeGetUpdatedAtRetType) { + setVolumeGetUpdatedAtAttributeType(&o.UpdatedAt, v) +} + +func (o Volume) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeGetAvailabilityZoneAttributeTypeOk(o.AvailabilityZone); ok { + toSerialize["AvailabilityZone"] = val + } + if val, ok := getVolumegetBootableAttributeTypeOk(o.Bootable); ok { + toSerialize["Bootable"] = val + } + if val, ok := getVolumeGetCreatedAtAttributeTypeOk(o.CreatedAt); ok { + toSerialize["CreatedAt"] = val + } + if val, ok := getVolumeGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getVolumegetEncryptedAttributeTypeOk(o.Encrypted); ok { + toSerialize["Encrypted"] = val + } + if val, ok := getVolumeGetEncryptionParametersAttributeTypeOk(o.EncryptionParameters); ok { + toSerialize["EncryptionParameters"] = val + } + if val, ok := getVolumeGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getVolumeGetImageConfigAttributeTypeOk(o.ImageConfig); ok { + toSerialize["ImageConfig"] = val + } + if val, ok := getVolumeGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getVolumeGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getVolumeGetPerformanceClassAttributeTypeOk(o.PerformanceClass); ok { + toSerialize["PerformanceClass"] = val + } + if val, ok := getVolumeGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getVolumeGetSizeAttributeTypeOk(o.Size); ok { + toSerialize["Size"] = val + } + if val, ok := getVolumeGetSourceAttributeTypeOk(o.Source); ok { + toSerialize["Source"] = val + } + if val, ok := getVolumeGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getVolumeGetUpdatedAtAttributeTypeOk(o.UpdatedAt); ok { + toSerialize["UpdatedAt"] = val + } + return toSerialize, nil +} + +type NullableVolume struct { + value *Volume + isSet bool +} + +func (v NullableVolume) Get() *Volume { + return v.value +} + +func (v *NullableVolume) Set(val *Volume) { + v.value = val + v.isSet = true +} + +func (v NullableVolume) IsSet() bool { + return v.isSet +} + +func (v *NullableVolume) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolume(val *Volume) *NullableVolume { + return &NullableVolume{value: val, isSet: true} +} + +func (v NullableVolume) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolume) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_attachment.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_attachment.go new file mode 100644 index 00000000..85a5881a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_attachment.go @@ -0,0 +1,226 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeAttachment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeAttachment{} + +/* + types and functions for deleteOnTermination +*/ + +// isBoolean +type VolumeAttachmentgetDeleteOnTerminationAttributeType = *bool +type VolumeAttachmentgetDeleteOnTerminationArgType = bool +type VolumeAttachmentgetDeleteOnTerminationRetType = bool + +func getVolumeAttachmentgetDeleteOnTerminationAttributeTypeOk(arg VolumeAttachmentgetDeleteOnTerminationAttributeType) (ret VolumeAttachmentgetDeleteOnTerminationRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentgetDeleteOnTerminationAttributeType(arg *VolumeAttachmentgetDeleteOnTerminationAttributeType, val VolumeAttachmentgetDeleteOnTerminationRetType) { + *arg = &val +} + +/* + types and functions for serverId +*/ + +// isNotNullableString +type VolumeAttachmentGetServerIdAttributeType = *string + +func getVolumeAttachmentGetServerIdAttributeTypeOk(arg VolumeAttachmentGetServerIdAttributeType) (ret VolumeAttachmentGetServerIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentGetServerIdAttributeType(arg *VolumeAttachmentGetServerIdAttributeType, val VolumeAttachmentGetServerIdRetType) { + *arg = &val +} + +type VolumeAttachmentGetServerIdArgType = string +type VolumeAttachmentGetServerIdRetType = string + +/* + types and functions for volumeId +*/ + +// isNotNullableString +type VolumeAttachmentGetVolumeIdAttributeType = *string + +func getVolumeAttachmentGetVolumeIdAttributeTypeOk(arg VolumeAttachmentGetVolumeIdAttributeType) (ret VolumeAttachmentGetVolumeIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentGetVolumeIdAttributeType(arg *VolumeAttachmentGetVolumeIdAttributeType, val VolumeAttachmentGetVolumeIdRetType) { + *arg = &val +} + +type VolumeAttachmentGetVolumeIdArgType = string +type VolumeAttachmentGetVolumeIdRetType = string + +// VolumeAttachment Object that represents a Volume attachment to a server. +type VolumeAttachment struct { + // Delete the volume during the termination of the server. Defaults to false. + DeleteOnTermination VolumeAttachmentgetDeleteOnTerminationAttributeType `json:"deleteOnTermination,omitempty"` + // Universally Unique Identifier (UUID). + ServerId VolumeAttachmentGetServerIdAttributeType `json:"serverId,omitempty"` + // Universally Unique Identifier (UUID). + VolumeId VolumeAttachmentGetVolumeIdAttributeType `json:"volumeId,omitempty"` +} + +// NewVolumeAttachment instantiates a new VolumeAttachment object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolumeAttachment() *VolumeAttachment { + this := VolumeAttachment{} + return &this +} + +// NewVolumeAttachmentWithDefaults instantiates a new VolumeAttachment object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumeAttachmentWithDefaults() *VolumeAttachment { + this := VolumeAttachment{} + return &this +} + +// GetDeleteOnTermination returns the DeleteOnTermination field value if set, zero value otherwise. +func (o *VolumeAttachment) GetDeleteOnTermination() (res VolumeAttachmentgetDeleteOnTerminationRetType) { + res, _ = o.GetDeleteOnTerminationOk() + return +} + +// GetDeleteOnTerminationOk returns a tuple with the DeleteOnTermination field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetDeleteOnTerminationOk() (ret VolumeAttachmentgetDeleteOnTerminationRetType, ok bool) { + return getVolumeAttachmentgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination) +} + +// HasDeleteOnTermination returns a boolean if a field has been set. +func (o *VolumeAttachment) HasDeleteOnTermination() bool { + _, ok := o.GetDeleteOnTerminationOk() + return ok +} + +// SetDeleteOnTermination gets a reference to the given bool and assigns it to the DeleteOnTermination field. +func (o *VolumeAttachment) SetDeleteOnTermination(v VolumeAttachmentgetDeleteOnTerminationRetType) { + setVolumeAttachmentgetDeleteOnTerminationAttributeType(&o.DeleteOnTermination, v) +} + +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *VolumeAttachment) GetServerId() (res VolumeAttachmentGetServerIdRetType) { + res, _ = o.GetServerIdOk() + return +} + +// GetServerIdOk returns a tuple with the ServerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetServerIdOk() (ret VolumeAttachmentGetServerIdRetType, ok bool) { + return getVolumeAttachmentGetServerIdAttributeTypeOk(o.ServerId) +} + +// HasServerId returns a boolean if a field has been set. +func (o *VolumeAttachment) HasServerId() bool { + _, ok := o.GetServerIdOk() + return ok +} + +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *VolumeAttachment) SetServerId(v VolumeAttachmentGetServerIdRetType) { + setVolumeAttachmentGetServerIdAttributeType(&o.ServerId, v) +} + +// GetVolumeId returns the VolumeId field value if set, zero value otherwise. +func (o *VolumeAttachment) GetVolumeId() (res VolumeAttachmentGetVolumeIdRetType) { + res, _ = o.GetVolumeIdOk() + return +} + +// GetVolumeIdOk returns a tuple with the VolumeId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeAttachment) GetVolumeIdOk() (ret VolumeAttachmentGetVolumeIdRetType, ok bool) { + return getVolumeAttachmentGetVolumeIdAttributeTypeOk(o.VolumeId) +} + +// HasVolumeId returns a boolean if a field has been set. +func (o *VolumeAttachment) HasVolumeId() bool { + _, ok := o.GetVolumeIdOk() + return ok +} + +// SetVolumeId gets a reference to the given string and assigns it to the VolumeId field. +func (o *VolumeAttachment) SetVolumeId(v VolumeAttachmentGetVolumeIdRetType) { + setVolumeAttachmentGetVolumeIdAttributeType(&o.VolumeId, v) +} + +func (o VolumeAttachment) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeAttachmentgetDeleteOnTerminationAttributeTypeOk(o.DeleteOnTermination); ok { + toSerialize["DeleteOnTermination"] = val + } + if val, ok := getVolumeAttachmentGetServerIdAttributeTypeOk(o.ServerId); ok { + toSerialize["ServerId"] = val + } + if val, ok := getVolumeAttachmentGetVolumeIdAttributeTypeOk(o.VolumeId); ok { + toSerialize["VolumeId"] = val + } + return toSerialize, nil +} + +type NullableVolumeAttachment struct { + value *VolumeAttachment + isSet bool +} + +func (v NullableVolumeAttachment) Get() *VolumeAttachment { + return v.value +} + +func (v *NullableVolumeAttachment) Set(val *VolumeAttachment) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAttachment) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAttachment) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAttachment(val *VolumeAttachment) *NullableVolumeAttachment { + return &NullableVolumeAttachment{value: val, isSet: true} +} + +func (v NullableVolumeAttachment) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAttachment) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_attachment_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_attachment_list_response.go new file mode 100644 index 00000000..43cd0a0a --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_attachment_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeAttachmentListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeAttachmentListResponse{} + +/* + types and functions for items +*/ + +// isArray +type VolumeAttachmentListResponseGetItemsAttributeType = *[]VolumeAttachment +type VolumeAttachmentListResponseGetItemsArgType = []VolumeAttachment +type VolumeAttachmentListResponseGetItemsRetType = []VolumeAttachment + +func getVolumeAttachmentListResponseGetItemsAttributeTypeOk(arg VolumeAttachmentListResponseGetItemsAttributeType) (ret VolumeAttachmentListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeAttachmentListResponseGetItemsAttributeType(arg *VolumeAttachmentListResponseGetItemsAttributeType, val VolumeAttachmentListResponseGetItemsRetType) { + *arg = &val +} + +// VolumeAttachmentListResponse Volume attachment list response. +type VolumeAttachmentListResponse struct { + // A list containing Volume attachments of a server. + // REQUIRED + Items VolumeAttachmentListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _VolumeAttachmentListResponse VolumeAttachmentListResponse + +// NewVolumeAttachmentListResponse instantiates a new VolumeAttachmentListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolumeAttachmentListResponse(items VolumeAttachmentListResponseGetItemsArgType) *VolumeAttachmentListResponse { + this := VolumeAttachmentListResponse{} + setVolumeAttachmentListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewVolumeAttachmentListResponseWithDefaults instantiates a new VolumeAttachmentListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumeAttachmentListResponseWithDefaults() *VolumeAttachmentListResponse { + this := VolumeAttachmentListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumeAttachmentListResponse) GetItems() (ret VolumeAttachmentListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *VolumeAttachmentListResponse) GetItemsOk() (ret VolumeAttachmentListResponseGetItemsRetType, ok bool) { + return getVolumeAttachmentListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *VolumeAttachmentListResponse) SetItems(v VolumeAttachmentListResponseGetItemsRetType) { + setVolumeAttachmentListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o VolumeAttachmentListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeAttachmentListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableVolumeAttachmentListResponse struct { + value *VolumeAttachmentListResponse + isSet bool +} + +func (v NullableVolumeAttachmentListResponse) Get() *VolumeAttachmentListResponse { + return v.value +} + +func (v *NullableVolumeAttachmentListResponse) Set(val *VolumeAttachmentListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeAttachmentListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeAttachmentListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeAttachmentListResponse(val *VolumeAttachmentListResponse) *NullableVolumeAttachmentListResponse { + return &NullableVolumeAttachmentListResponse{value: val, isSet: true} +} + +func (v NullableVolumeAttachmentListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeAttachmentListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_encryption_parameter.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_encryption_parameter.go new file mode 100644 index 00000000..c927a707 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_encryption_parameter.go @@ -0,0 +1,358 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeEncryptionParameter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeEncryptionParameter{} + +/* + types and functions for kekKeyId +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetKekKeyIdAttributeType = *string + +func getVolumeEncryptionParameterGetKekKeyIdAttributeTypeOk(arg VolumeEncryptionParameterGetKekKeyIdAttributeType) (ret VolumeEncryptionParameterGetKekKeyIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekKeyIdAttributeType(arg *VolumeEncryptionParameterGetKekKeyIdAttributeType, val VolumeEncryptionParameterGetKekKeyIdRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetKekKeyIdArgType = string +type VolumeEncryptionParameterGetKekKeyIdRetType = string + +/* + types and functions for kekKeyVersion +*/ + +// isLong +type VolumeEncryptionParameterGetKekKeyVersionAttributeType = *int64 +type VolumeEncryptionParameterGetKekKeyVersionArgType = int64 +type VolumeEncryptionParameterGetKekKeyVersionRetType = int64 + +func getVolumeEncryptionParameterGetKekKeyVersionAttributeTypeOk(arg VolumeEncryptionParameterGetKekKeyVersionAttributeType) (ret VolumeEncryptionParameterGetKekKeyVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekKeyVersionAttributeType(arg *VolumeEncryptionParameterGetKekKeyVersionAttributeType, val VolumeEncryptionParameterGetKekKeyVersionRetType) { + *arg = &val +} + +/* + types and functions for kekKeyringId +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetKekKeyringIdAttributeType = *string + +func getVolumeEncryptionParameterGetKekKeyringIdAttributeTypeOk(arg VolumeEncryptionParameterGetKekKeyringIdAttributeType) (ret VolumeEncryptionParameterGetKekKeyringIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekKeyringIdAttributeType(arg *VolumeEncryptionParameterGetKekKeyringIdAttributeType, val VolumeEncryptionParameterGetKekKeyringIdRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetKekKeyringIdArgType = string +type VolumeEncryptionParameterGetKekKeyringIdRetType = string + +/* + types and functions for kekProjectId +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetKekProjectIdAttributeType = *string + +func getVolumeEncryptionParameterGetKekProjectIdAttributeTypeOk(arg VolumeEncryptionParameterGetKekProjectIdAttributeType) (ret VolumeEncryptionParameterGetKekProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKekProjectIdAttributeType(arg *VolumeEncryptionParameterGetKekProjectIdAttributeType, val VolumeEncryptionParameterGetKekProjectIdRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetKekProjectIdArgType = string +type VolumeEncryptionParameterGetKekProjectIdRetType = string + +/* + types and functions for keyPayload +*/ + +// isByteArray +type VolumeEncryptionParameterGetKeyPayloadAttributeType = *[]byte +type VolumeEncryptionParameterGetKeyPayloadArgType = []byte +type VolumeEncryptionParameterGetKeyPayloadRetType = []byte + +func getVolumeEncryptionParameterGetKeyPayloadAttributeTypeOk(arg VolumeEncryptionParameterGetKeyPayloadAttributeType) (ret VolumeEncryptionParameterGetKeyPayloadRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetKeyPayloadAttributeType(arg *VolumeEncryptionParameterGetKeyPayloadAttributeType, val VolumeEncryptionParameterGetKeyPayloadRetType) { + *arg = &val +} + +/* + types and functions for serviceAccount +*/ + +// isNotNullableString +type VolumeEncryptionParameterGetServiceAccountAttributeType = *string + +func getVolumeEncryptionParameterGetServiceAccountAttributeTypeOk(arg VolumeEncryptionParameterGetServiceAccountAttributeType) (ret VolumeEncryptionParameterGetServiceAccountRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeEncryptionParameterGetServiceAccountAttributeType(arg *VolumeEncryptionParameterGetServiceAccountAttributeType, val VolumeEncryptionParameterGetServiceAccountRetType) { + *arg = &val +} + +type VolumeEncryptionParameterGetServiceAccountArgType = string +type VolumeEncryptionParameterGetServiceAccountRetType = string + +// VolumeEncryptionParameter Parameter to connect to a key-encryption-key within the STACKIT-KMS to create encrypted volumes. If no key_payload is set, a random passphrase is generated, which will be encrypted against the STACKIT-KMS. These parameter never leave the backend again. So these parameters are not in the responses. +type VolumeEncryptionParameter struct { + // Universally Unique Identifier (UUID). + // REQUIRED + KekKeyId VolumeEncryptionParameterGetKekKeyIdAttributeType `json:"kekKeyId" required:"true"` + // Version of a key within the STACKIT-KMS. + // REQUIRED + KekKeyVersion VolumeEncryptionParameterGetKekKeyVersionAttributeType `json:"kekKeyVersion" required:"true"` + // Universally Unique Identifier (UUID). + // REQUIRED + KekKeyringId VolumeEncryptionParameterGetKekKeyringIdAttributeType `json:"kekKeyringId" required:"true"` + // Universally Unique Identifier (UUID). + KekProjectId VolumeEncryptionParameterGetKekProjectIdAttributeType `json:"kekProjectId,omitempty"` + // base64 encoded secret. + KeyPayload VolumeEncryptionParameterGetKeyPayloadAttributeType `json:"keyPayload,omitempty"` + // Object that represents an e-mail address of a service account. + // REQUIRED + ServiceAccount VolumeEncryptionParameterGetServiceAccountAttributeType `json:"serviceAccount" required:"true"` +} + +type _VolumeEncryptionParameter VolumeEncryptionParameter + +// NewVolumeEncryptionParameter instantiates a new VolumeEncryptionParameter object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolumeEncryptionParameter(kekKeyId VolumeEncryptionParameterGetKekKeyIdArgType, kekKeyVersion VolumeEncryptionParameterGetKekKeyVersionArgType, kekKeyringId VolumeEncryptionParameterGetKekKeyringIdArgType, serviceAccount VolumeEncryptionParameterGetServiceAccountArgType) *VolumeEncryptionParameter { + this := VolumeEncryptionParameter{} + setVolumeEncryptionParameterGetKekKeyIdAttributeType(&this.KekKeyId, kekKeyId) + setVolumeEncryptionParameterGetKekKeyVersionAttributeType(&this.KekKeyVersion, kekKeyVersion) + setVolumeEncryptionParameterGetKekKeyringIdAttributeType(&this.KekKeyringId, kekKeyringId) + setVolumeEncryptionParameterGetServiceAccountAttributeType(&this.ServiceAccount, serviceAccount) + return &this +} + +// NewVolumeEncryptionParameterWithDefaults instantiates a new VolumeEncryptionParameter object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumeEncryptionParameterWithDefaults() *VolumeEncryptionParameter { + this := VolumeEncryptionParameter{} + return &this +} + +// GetKekKeyId returns the KekKeyId field value +func (o *VolumeEncryptionParameter) GetKekKeyId() (ret VolumeEncryptionParameterGetKekKeyIdRetType) { + ret, _ = o.GetKekKeyIdOk() + return ret +} + +// GetKekKeyIdOk returns a tuple with the KekKeyId field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekKeyIdOk() (ret VolumeEncryptionParameterGetKekKeyIdRetType, ok bool) { + return getVolumeEncryptionParameterGetKekKeyIdAttributeTypeOk(o.KekKeyId) +} + +// SetKekKeyId sets field value +func (o *VolumeEncryptionParameter) SetKekKeyId(v VolumeEncryptionParameterGetKekKeyIdRetType) { + setVolumeEncryptionParameterGetKekKeyIdAttributeType(&o.KekKeyId, v) +} + +// GetKekKeyVersion returns the KekKeyVersion field value +func (o *VolumeEncryptionParameter) GetKekKeyVersion() (ret VolumeEncryptionParameterGetKekKeyVersionRetType) { + ret, _ = o.GetKekKeyVersionOk() + return ret +} + +// GetKekKeyVersionOk returns a tuple with the KekKeyVersion field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekKeyVersionOk() (ret VolumeEncryptionParameterGetKekKeyVersionRetType, ok bool) { + return getVolumeEncryptionParameterGetKekKeyVersionAttributeTypeOk(o.KekKeyVersion) +} + +// SetKekKeyVersion sets field value +func (o *VolumeEncryptionParameter) SetKekKeyVersion(v VolumeEncryptionParameterGetKekKeyVersionRetType) { + setVolumeEncryptionParameterGetKekKeyVersionAttributeType(&o.KekKeyVersion, v) +} + +// GetKekKeyringId returns the KekKeyringId field value +func (o *VolumeEncryptionParameter) GetKekKeyringId() (ret VolumeEncryptionParameterGetKekKeyringIdRetType) { + ret, _ = o.GetKekKeyringIdOk() + return ret +} + +// GetKekKeyringIdOk returns a tuple with the KekKeyringId field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekKeyringIdOk() (ret VolumeEncryptionParameterGetKekKeyringIdRetType, ok bool) { + return getVolumeEncryptionParameterGetKekKeyringIdAttributeTypeOk(o.KekKeyringId) +} + +// SetKekKeyringId sets field value +func (o *VolumeEncryptionParameter) SetKekKeyringId(v VolumeEncryptionParameterGetKekKeyringIdRetType) { + setVolumeEncryptionParameterGetKekKeyringIdAttributeType(&o.KekKeyringId, v) +} + +// GetKekProjectId returns the KekProjectId field value if set, zero value otherwise. +func (o *VolumeEncryptionParameter) GetKekProjectId() (res VolumeEncryptionParameterGetKekProjectIdRetType) { + res, _ = o.GetKekProjectIdOk() + return +} + +// GetKekProjectIdOk returns a tuple with the KekProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKekProjectIdOk() (ret VolumeEncryptionParameterGetKekProjectIdRetType, ok bool) { + return getVolumeEncryptionParameterGetKekProjectIdAttributeTypeOk(o.KekProjectId) +} + +// HasKekProjectId returns a boolean if a field has been set. +func (o *VolumeEncryptionParameter) HasKekProjectId() bool { + _, ok := o.GetKekProjectIdOk() + return ok +} + +// SetKekProjectId gets a reference to the given string and assigns it to the KekProjectId field. +func (o *VolumeEncryptionParameter) SetKekProjectId(v VolumeEncryptionParameterGetKekProjectIdRetType) { + setVolumeEncryptionParameterGetKekProjectIdAttributeType(&o.KekProjectId, v) +} + +// GetKeyPayload returns the KeyPayload field value if set, zero value otherwise. +func (o *VolumeEncryptionParameter) GetKeyPayload() (res VolumeEncryptionParameterGetKeyPayloadRetType) { + res, _ = o.GetKeyPayloadOk() + return +} + +// GetKeyPayloadOk returns a tuple with the KeyPayload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetKeyPayloadOk() (ret VolumeEncryptionParameterGetKeyPayloadRetType, ok bool) { + return getVolumeEncryptionParameterGetKeyPayloadAttributeTypeOk(o.KeyPayload) +} + +// HasKeyPayload returns a boolean if a field has been set. +func (o *VolumeEncryptionParameter) HasKeyPayload() bool { + _, ok := o.GetKeyPayloadOk() + return ok +} + +// SetKeyPayload gets a reference to the given string and assigns it to the KeyPayload field. +func (o *VolumeEncryptionParameter) SetKeyPayload(v VolumeEncryptionParameterGetKeyPayloadRetType) { + setVolumeEncryptionParameterGetKeyPayloadAttributeType(&o.KeyPayload, v) +} + +// GetServiceAccount returns the ServiceAccount field value +func (o *VolumeEncryptionParameter) GetServiceAccount() (ret VolumeEncryptionParameterGetServiceAccountRetType) { + ret, _ = o.GetServiceAccountOk() + return ret +} + +// GetServiceAccountOk returns a tuple with the ServiceAccount field value +// and a boolean to check if the value has been set. +func (o *VolumeEncryptionParameter) GetServiceAccountOk() (ret VolumeEncryptionParameterGetServiceAccountRetType, ok bool) { + return getVolumeEncryptionParameterGetServiceAccountAttributeTypeOk(o.ServiceAccount) +} + +// SetServiceAccount sets field value +func (o *VolumeEncryptionParameter) SetServiceAccount(v VolumeEncryptionParameterGetServiceAccountRetType) { + setVolumeEncryptionParameterGetServiceAccountAttributeType(&o.ServiceAccount, v) +} + +func (o VolumeEncryptionParameter) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeEncryptionParameterGetKekKeyIdAttributeTypeOk(o.KekKeyId); ok { + toSerialize["KekKeyId"] = val + } + if val, ok := getVolumeEncryptionParameterGetKekKeyVersionAttributeTypeOk(o.KekKeyVersion); ok { + toSerialize["KekKeyVersion"] = val + } + if val, ok := getVolumeEncryptionParameterGetKekKeyringIdAttributeTypeOk(o.KekKeyringId); ok { + toSerialize["KekKeyringId"] = val + } + if val, ok := getVolumeEncryptionParameterGetKekProjectIdAttributeTypeOk(o.KekProjectId); ok { + toSerialize["KekProjectId"] = val + } + if val, ok := getVolumeEncryptionParameterGetKeyPayloadAttributeTypeOk(o.KeyPayload); ok { + toSerialize["KeyPayload"] = val + } + if val, ok := getVolumeEncryptionParameterGetServiceAccountAttributeTypeOk(o.ServiceAccount); ok { + toSerialize["ServiceAccount"] = val + } + return toSerialize, nil +} + +type NullableVolumeEncryptionParameter struct { + value *VolumeEncryptionParameter + isSet bool +} + +func (v NullableVolumeEncryptionParameter) Get() *VolumeEncryptionParameter { + return v.value +} + +func (v *NullableVolumeEncryptionParameter) Set(val *VolumeEncryptionParameter) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeEncryptionParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeEncryptionParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeEncryptionParameter(val *VolumeEncryptionParameter) *NullableVolumeEncryptionParameter { + return &NullableVolumeEncryptionParameter{value: val, isSet: true} +} + +func (v NullableVolumeEncryptionParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeEncryptionParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_list_response.go new file mode 100644 index 00000000..7a34e707 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeListResponse{} + +/* + types and functions for items +*/ + +// isArray +type VolumeListResponseGetItemsAttributeType = *[]Volume +type VolumeListResponseGetItemsArgType = []Volume +type VolumeListResponseGetItemsRetType = []Volume + +func getVolumeListResponseGetItemsAttributeTypeOk(arg VolumeListResponseGetItemsAttributeType) (ret VolumeListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeListResponseGetItemsAttributeType(arg *VolumeListResponseGetItemsAttributeType, val VolumeListResponseGetItemsRetType) { + *arg = &val +} + +// VolumeListResponse Volume list response. +type VolumeListResponse struct { + // A list containing volume objects. + // REQUIRED + Items VolumeListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _VolumeListResponse VolumeListResponse + +// NewVolumeListResponse instantiates a new VolumeListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolumeListResponse(items VolumeListResponseGetItemsArgType) *VolumeListResponse { + this := VolumeListResponse{} + setVolumeListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewVolumeListResponseWithDefaults instantiates a new VolumeListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumeListResponseWithDefaults() *VolumeListResponse { + this := VolumeListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumeListResponse) GetItems() (ret VolumeListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *VolumeListResponse) GetItemsOk() (ret VolumeListResponseGetItemsRetType, ok bool) { + return getVolumeListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *VolumeListResponse) SetItems(v VolumeListResponseGetItemsRetType) { + setVolumeListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o VolumeListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableVolumeListResponse struct { + value *VolumeListResponse + isSet bool +} + +func (v NullableVolumeListResponse) Get() *VolumeListResponse { + return v.value +} + +func (v *NullableVolumeListResponse) Set(val *VolumeListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeListResponse(val *VolumeListResponse) *NullableVolumeListResponse { + return &NullableVolumeListResponse{value: val, isSet: true} +} + +func (v NullableVolumeListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_performance_class.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_performance_class.go new file mode 100644 index 00000000..2e9b2f8c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_performance_class.go @@ -0,0 +1,320 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumePerformanceClass type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumePerformanceClass{} + +/* + types and functions for description +*/ + +// isNotNullableString +type VolumePerformanceClassGetDescriptionAttributeType = *string + +func getVolumePerformanceClassGetDescriptionAttributeTypeOk(arg VolumePerformanceClassGetDescriptionAttributeType) (ret VolumePerformanceClassGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetDescriptionAttributeType(arg *VolumePerformanceClassGetDescriptionAttributeType, val VolumePerformanceClassGetDescriptionRetType) { + *arg = &val +} + +type VolumePerformanceClassGetDescriptionArgType = string +type VolumePerformanceClassGetDescriptionRetType = string + +/* + types and functions for iops +*/ + +// isLong +type VolumePerformanceClassGetIopsAttributeType = *int64 +type VolumePerformanceClassGetIopsArgType = int64 +type VolumePerformanceClassGetIopsRetType = int64 + +func getVolumePerformanceClassGetIopsAttributeTypeOk(arg VolumePerformanceClassGetIopsAttributeType) (ret VolumePerformanceClassGetIopsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetIopsAttributeType(arg *VolumePerformanceClassGetIopsAttributeType, val VolumePerformanceClassGetIopsRetType) { + *arg = &val +} + +/* + types and functions for labels +*/ + +// isFreeform +type VolumePerformanceClassGetLabelsAttributeType = *map[string]interface{} +type VolumePerformanceClassGetLabelsArgType = map[string]interface{} +type VolumePerformanceClassGetLabelsRetType = map[string]interface{} + +func getVolumePerformanceClassGetLabelsAttributeTypeOk(arg VolumePerformanceClassGetLabelsAttributeType) (ret VolumePerformanceClassGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetLabelsAttributeType(arg *VolumePerformanceClassGetLabelsAttributeType, val VolumePerformanceClassGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for name +*/ + +// isNotNullableString +type VolumePerformanceClassGetNameAttributeType = *string + +func getVolumePerformanceClassGetNameAttributeTypeOk(arg VolumePerformanceClassGetNameAttributeType) (ret VolumePerformanceClassGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetNameAttributeType(arg *VolumePerformanceClassGetNameAttributeType, val VolumePerformanceClassGetNameRetType) { + *arg = &val +} + +type VolumePerformanceClassGetNameArgType = string +type VolumePerformanceClassGetNameRetType = string + +/* + types and functions for throughput +*/ + +// isLong +type VolumePerformanceClassGetThroughputAttributeType = *int64 +type VolumePerformanceClassGetThroughputArgType = int64 +type VolumePerformanceClassGetThroughputRetType = int64 + +func getVolumePerformanceClassGetThroughputAttributeTypeOk(arg VolumePerformanceClassGetThroughputAttributeType) (ret VolumePerformanceClassGetThroughputRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassGetThroughputAttributeType(arg *VolumePerformanceClassGetThroughputAttributeType, val VolumePerformanceClassGetThroughputRetType) { + *arg = &val +} + +// VolumePerformanceClass Object that represents a Volume performance class. +type VolumePerformanceClass struct { + // Description Object. Allows string up to 255 Characters. + Description VolumePerformanceClassGetDescriptionAttributeType `json:"description,omitempty"` + // Input/Output Operations per second. + Iops VolumePerformanceClassGetIopsAttributeType `json:"iops,omitempty"` + // Object that represents the labels of an object. Regex for keys: `^(?=.{1,63}$)([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$`. Regex for values: `^(?=.{0,63}$)(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])*$`. Providing a `null` value for a key will remove that key. + Labels VolumePerformanceClassGetLabelsAttributeType `json:"labels,omitempty"` + // The name for a General Object. Matches Names and also UUIDs. + // REQUIRED + Name VolumePerformanceClassGetNameAttributeType `json:"name" required:"true"` + // Throughput in Megabyte per second. + Throughput VolumePerformanceClassGetThroughputAttributeType `json:"throughput,omitempty"` +} + +type _VolumePerformanceClass VolumePerformanceClass + +// NewVolumePerformanceClass instantiates a new VolumePerformanceClass object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolumePerformanceClass(name VolumePerformanceClassGetNameArgType) *VolumePerformanceClass { + this := VolumePerformanceClass{} + setVolumePerformanceClassGetNameAttributeType(&this.Name, name) + return &this +} + +// NewVolumePerformanceClassWithDefaults instantiates a new VolumePerformanceClass object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumePerformanceClassWithDefaults() *VolumePerformanceClass { + this := VolumePerformanceClass{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetDescription() (res VolumePerformanceClassGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetDescriptionOk() (ret VolumePerformanceClassGetDescriptionRetType, ok bool) { + return getVolumePerformanceClassGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *VolumePerformanceClass) SetDescription(v VolumePerformanceClassGetDescriptionRetType) { + setVolumePerformanceClassGetDescriptionAttributeType(&o.Description, v) +} + +// GetIops returns the Iops field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetIops() (res VolumePerformanceClassGetIopsRetType) { + res, _ = o.GetIopsOk() + return +} + +// GetIopsOk returns a tuple with the Iops field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetIopsOk() (ret VolumePerformanceClassGetIopsRetType, ok bool) { + return getVolumePerformanceClassGetIopsAttributeTypeOk(o.Iops) +} + +// HasIops returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasIops() bool { + _, ok := o.GetIopsOk() + return ok +} + +// SetIops gets a reference to the given int64 and assigns it to the Iops field. +func (o *VolumePerformanceClass) SetIops(v VolumePerformanceClassGetIopsRetType) { + setVolumePerformanceClassGetIopsAttributeType(&o.Iops, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetLabels() (res VolumePerformanceClassGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetLabelsOk() (ret VolumePerformanceClassGetLabelsRetType, ok bool) { + return getVolumePerformanceClassGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *VolumePerformanceClass) SetLabels(v VolumePerformanceClassGetLabelsRetType) { + setVolumePerformanceClassGetLabelsAttributeType(&o.Labels, v) +} + +// GetName returns the Name field value +func (o *VolumePerformanceClass) GetName() (ret VolumePerformanceClassGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetNameOk() (ret VolumePerformanceClassGetNameRetType, ok bool) { + return getVolumePerformanceClassGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *VolumePerformanceClass) SetName(v VolumePerformanceClassGetNameRetType) { + setVolumePerformanceClassGetNameAttributeType(&o.Name, v) +} + +// GetThroughput returns the Throughput field value if set, zero value otherwise. +func (o *VolumePerformanceClass) GetThroughput() (res VolumePerformanceClassGetThroughputRetType) { + res, _ = o.GetThroughputOk() + return +} + +// GetThroughputOk returns a tuple with the Throughput field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClass) GetThroughputOk() (ret VolumePerformanceClassGetThroughputRetType, ok bool) { + return getVolumePerformanceClassGetThroughputAttributeTypeOk(o.Throughput) +} + +// HasThroughput returns a boolean if a field has been set. +func (o *VolumePerformanceClass) HasThroughput() bool { + _, ok := o.GetThroughputOk() + return ok +} + +// SetThroughput gets a reference to the given int64 and assigns it to the Throughput field. +func (o *VolumePerformanceClass) SetThroughput(v VolumePerformanceClassGetThroughputRetType) { + setVolumePerformanceClassGetThroughputAttributeType(&o.Throughput, v) +} + +func (o VolumePerformanceClass) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumePerformanceClassGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + if val, ok := getVolumePerformanceClassGetIopsAttributeTypeOk(o.Iops); ok { + toSerialize["Iops"] = val + } + if val, ok := getVolumePerformanceClassGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getVolumePerformanceClassGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getVolumePerformanceClassGetThroughputAttributeTypeOk(o.Throughput); ok { + toSerialize["Throughput"] = val + } + return toSerialize, nil +} + +type NullableVolumePerformanceClass struct { + value *VolumePerformanceClass + isSet bool +} + +func (v NullableVolumePerformanceClass) Get() *VolumePerformanceClass { + return v.value +} + +func (v *NullableVolumePerformanceClass) Set(val *VolumePerformanceClass) { + v.value = val + v.isSet = true +} + +func (v NullableVolumePerformanceClass) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumePerformanceClass) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumePerformanceClass(val *VolumePerformanceClass) *NullableVolumePerformanceClass { + return &NullableVolumePerformanceClass{value: val, isSet: true} +} + +func (v NullableVolumePerformanceClass) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumePerformanceClass) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_performance_class_list_response.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_performance_class_list_response.go new file mode 100644 index 00000000..99832f5c --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_performance_class_list_response.go @@ -0,0 +1,126 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumePerformanceClassListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumePerformanceClassListResponse{} + +/* + types and functions for items +*/ + +// isArray +type VolumePerformanceClassListResponseGetItemsAttributeType = *[]VolumePerformanceClass +type VolumePerformanceClassListResponseGetItemsArgType = []VolumePerformanceClass +type VolumePerformanceClassListResponseGetItemsRetType = []VolumePerformanceClass + +func getVolumePerformanceClassListResponseGetItemsAttributeTypeOk(arg VolumePerformanceClassListResponseGetItemsAttributeType) (ret VolumePerformanceClassListResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumePerformanceClassListResponseGetItemsAttributeType(arg *VolumePerformanceClassListResponseGetItemsAttributeType, val VolumePerformanceClassListResponseGetItemsRetType) { + *arg = &val +} + +// VolumePerformanceClassListResponse Volume performance class list response. +type VolumePerformanceClassListResponse struct { + // A list containing Volume performance classes. + // REQUIRED + Items VolumePerformanceClassListResponseGetItemsAttributeType `json:"items" required:"true"` +} + +type _VolumePerformanceClassListResponse VolumePerformanceClassListResponse + +// NewVolumePerformanceClassListResponse instantiates a new VolumePerformanceClassListResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolumePerformanceClassListResponse(items VolumePerformanceClassListResponseGetItemsArgType) *VolumePerformanceClassListResponse { + this := VolumePerformanceClassListResponse{} + setVolumePerformanceClassListResponseGetItemsAttributeType(&this.Items, items) + return &this +} + +// NewVolumePerformanceClassListResponseWithDefaults instantiates a new VolumePerformanceClassListResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumePerformanceClassListResponseWithDefaults() *VolumePerformanceClassListResponse { + this := VolumePerformanceClassListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *VolumePerformanceClassListResponse) GetItems() (ret VolumePerformanceClassListResponseGetItemsRetType) { + ret, _ = o.GetItemsOk() + return ret +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *VolumePerformanceClassListResponse) GetItemsOk() (ret VolumePerformanceClassListResponseGetItemsRetType, ok bool) { + return getVolumePerformanceClassListResponseGetItemsAttributeTypeOk(o.Items) +} + +// SetItems sets field value +func (o *VolumePerformanceClassListResponse) SetItems(v VolumePerformanceClassListResponseGetItemsRetType) { + setVolumePerformanceClassListResponseGetItemsAttributeType(&o.Items, v) +} + +func (o VolumePerformanceClassListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumePerformanceClassListResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + return toSerialize, nil +} + +type NullableVolumePerformanceClassListResponse struct { + value *VolumePerformanceClassListResponse + isSet bool +} + +func (v NullableVolumePerformanceClassListResponse) Get() *VolumePerformanceClassListResponse { + return v.value +} + +func (v *NullableVolumePerformanceClassListResponse) Set(val *VolumePerformanceClassListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVolumePerformanceClassListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumePerformanceClassListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumePerformanceClassListResponse(val *VolumePerformanceClassListResponse) *NullableVolumePerformanceClassListResponse { + return &NullableVolumePerformanceClassListResponse{value: val, isSet: true} +} + +func (v NullableVolumePerformanceClassListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumePerformanceClassListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_source.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_source.go new file mode 100644 index 00000000..ff9c0b5f --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/model_volume_source.go @@ -0,0 +1,172 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the VolumeSource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeSource{} + +/* + types and functions for id +*/ + +// isNotNullableString +type VolumeSourceGetIdAttributeType = *string + +func getVolumeSourceGetIdAttributeTypeOk(arg VolumeSourceGetIdAttributeType) (ret VolumeSourceGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeSourceGetIdAttributeType(arg *VolumeSourceGetIdAttributeType, val VolumeSourceGetIdRetType) { + *arg = &val +} + +type VolumeSourceGetIdArgType = string +type VolumeSourceGetIdRetType = string + +/* + types and functions for type +*/ + +// isNotNullableString +type VolumeSourceGetTypeAttributeType = *string + +func getVolumeSourceGetTypeAttributeTypeOk(arg VolumeSourceGetTypeAttributeType) (ret VolumeSourceGetTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setVolumeSourceGetTypeAttributeType(arg *VolumeSourceGetTypeAttributeType, val VolumeSourceGetTypeRetType) { + *arg = &val +} + +type VolumeSourceGetTypeArgType = string +type VolumeSourceGetTypeRetType = string + +// VolumeSource The source object of a volume. +type VolumeSource struct { + // Universally Unique Identifier (UUID). + // REQUIRED + Id VolumeSourceGetIdAttributeType `json:"id" required:"true"` + // The source types of a volume. Possible values: `image`, `volume`, `snapshot`, `backup`. + // REQUIRED + Type VolumeSourceGetTypeAttributeType `json:"type" required:"true"` +} + +type _VolumeSource VolumeSource + +// NewVolumeSource instantiates a new VolumeSource object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewVolumeSource(id VolumeSourceGetIdArgType, types VolumeSourceGetTypeArgType) *VolumeSource { + this := VolumeSource{} + setVolumeSourceGetIdAttributeType(&this.Id, id) + setVolumeSourceGetTypeAttributeType(&this.Type, types) + return &this +} + +// NewVolumeSourceWithDefaults instantiates a new VolumeSource object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewVolumeSourceWithDefaults() *VolumeSource { + this := VolumeSource{} + return &this +} + +// GetId returns the Id field value +func (o *VolumeSource) GetId() (ret VolumeSourceGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *VolumeSource) GetIdOk() (ret VolumeSourceGetIdRetType, ok bool) { + return getVolumeSourceGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *VolumeSource) SetId(v VolumeSourceGetIdRetType) { + setVolumeSourceGetIdAttributeType(&o.Id, v) +} + +// GetType returns the Type field value +func (o *VolumeSource) GetType() (ret VolumeSourceGetTypeRetType) { + ret, _ = o.GetTypeOk() + return ret +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *VolumeSource) GetTypeOk() (ret VolumeSourceGetTypeRetType, ok bool) { + return getVolumeSourceGetTypeAttributeTypeOk(o.Type) +} + +// SetType sets field value +func (o *VolumeSource) SetType(v VolumeSourceGetTypeRetType) { + setVolumeSourceGetTypeAttributeType(&o.Type, v) +} + +func (o VolumeSource) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getVolumeSourceGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getVolumeSourceGetTypeAttributeTypeOk(o.Type); ok { + toSerialize["Type"] = val + } + return toSerialize, nil +} + +type NullableVolumeSource struct { + value *VolumeSource + isSet bool +} + +func (v NullableVolumeSource) Get() *VolumeSource { + return v.value +} + +func (v *NullableVolumeSource) Set(val *VolumeSource) { + v.value = val + v.isSet = true +} + +func (v NullableVolumeSource) IsSet() bool { + return v.isSet +} + +func (v *NullableVolumeSource) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVolumeSource(val *VolumeSource) *NullableVolumeSource { + return &NullableVolumeSource{value: val, isSet: true} +} + +func (v NullableVolumeSource) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVolumeSource) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/utils.go b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/utils.go new file mode 100644 index 00000000..eabdf254 --- /dev/null +++ b/vendor/github.com/stackitcloud/stackit-sdk-go/services/iaas/utils.go @@ -0,0 +1,385 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 2 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" + "math/rand" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index bd669cd9..583d173d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -64,6 +64,9 @@ github.com/go-task/slim-sprig/v3 ## explicit github.com/gogo/protobuf/proto github.com/gogo/protobuf/sortkeys +# github.com/golang-jwt/jwt/v5 v5.3.0 +## explicit; go 1.21 +github.com/golang-jwt/jwt/v5 # github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7 ## explicit github.com/golang/groupcache/lru @@ -87,6 +90,9 @@ github.com/google/gofuzz # github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 ## explicit; go 1.23 github.com/google/pprof/profile +# github.com/google/uuid v1.6.0 +## explicit +github.com/google/uuid # github.com/googleapis/gnostic v0.2.0 ## explicit github.com/googleapis/gnostic/OpenAPIv2 @@ -198,6 +204,15 @@ github.com/prometheus/procfs/xfs # github.com/spf13/pflag v1.0.5 ## explicit; go 1.12 github.com/spf13/pflag +# github.com/stackitcloud/stackit-sdk-go/core v0.18.0 +## explicit; go 1.21 +github.com/stackitcloud/stackit-sdk-go/core/auth +github.com/stackitcloud/stackit-sdk-go/core/clients +github.com/stackitcloud/stackit-sdk-go/core/config +github.com/stackitcloud/stackit-sdk-go/core/oapierror +# github.com/stackitcloud/stackit-sdk-go/services/iaas v1.0.0 +## explicit; go 1.21 +github.com/stackitcloud/stackit-sdk-go/services/iaas # github.com/stretchr/testify v1.9.0 ## explicit; go 1.17 # go.yaml.in/yaml/v3 v3.0.4