## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
30658 lines
1.1 MiB
30658 lines
1.1 MiB
/*
|
|
STACKIT IaaS API
|
|
|
|
This API allows you to create and modify IaaS resources.
|
|
|
|
API version: 2beta1
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package iaasbeta
|
|
|
|
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)
|
|
/*
|
|
CreateIsolatedNetwork Create a single isolated network.
|
|
Creates an isolated network which is not connected to other networks in this project. We recommend using this endpoint only if you are fully aware of its purpose and the consequences of its execution.
|
|
|
|
@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 ApiCreateIsolatedNetworkRequest
|
|
*/
|
|
CreateIsolatedNetwork(ctx context.Context, projectId string, region string) ApiCreateIsolatedNetworkRequest
|
|
/*
|
|
CreateIsolatedNetworkExecute 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
|
|
|
|
*/
|
|
CreateIsolatedNetworkExecute(ctx context.Context, projectId string, region string) (*Network, 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)
|
|
/*
|
|
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)
|
|
/*
|
|
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
|
|
/*
|
|
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
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
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)
|
|
/*
|
|
V2beta1ConfigureNetworkAreaRegion 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 ApiV2beta1ConfigureNetworkAreaRegionRequest
|
|
*/
|
|
V2beta1ConfigureNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1ConfigureNetworkAreaRegionRequest
|
|
/*
|
|
V2beta1ConfigureNetworkAreaRegionExecute 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
|
|
|
|
*/
|
|
V2beta1ConfigureNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error)
|
|
/*
|
|
V2beta1CreateSnapshot 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 ApiV2beta1CreateSnapshotRequest
|
|
*/
|
|
V2beta1CreateSnapshot(ctx context.Context, projectId string, region string) ApiV2beta1CreateSnapshotRequest
|
|
/*
|
|
V2beta1CreateSnapshotExecute 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
|
|
|
|
*/
|
|
V2beta1CreateSnapshotExecute(ctx context.Context, projectId string, region string) (*Snapshot, error)
|
|
/*
|
|
V2beta1DeleteNetworkAreaRegion 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 ApiV2beta1DeleteNetworkAreaRegionRequest
|
|
*/
|
|
V2beta1DeleteNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1DeleteNetworkAreaRegionRequest
|
|
/*
|
|
V2beta1DeleteNetworkAreaRegionExecute executes the request
|
|
|
|
*/
|
|
V2beta1DeleteNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) error
|
|
/*
|
|
V2beta1DeleteSnapshot 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 ApiV2beta1DeleteSnapshotRequest
|
|
*/
|
|
V2beta1DeleteSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1DeleteSnapshotRequest
|
|
/*
|
|
V2beta1DeleteSnapshotExecute executes the request
|
|
|
|
*/
|
|
V2beta1DeleteSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) error
|
|
/*
|
|
V2beta1GetAreaRegion 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 ApiV2beta1GetAreaRegionRequest
|
|
*/
|
|
V2beta1GetAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1GetAreaRegionRequest
|
|
/*
|
|
V2beta1GetAreaRegionExecute 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
|
|
|
|
*/
|
|
V2beta1GetAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error)
|
|
/*
|
|
V2beta1GetSnapshot 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 ApiV2beta1GetSnapshotRequest
|
|
*/
|
|
V2beta1GetSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1GetSnapshotRequest
|
|
/*
|
|
V2beta1GetSnapshotExecute 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
|
|
|
|
*/
|
|
V2beta1GetSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error)
|
|
/*
|
|
V2beta1ListAreaRegions 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 ApiV2beta1ListAreaRegionsRequest
|
|
*/
|
|
V2beta1ListAreaRegions(ctx context.Context, organizationId string, areaId string) ApiV2beta1ListAreaRegionsRequest
|
|
/*
|
|
V2beta1ListAreaRegionsExecute 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
|
|
|
|
*/
|
|
V2beta1ListAreaRegionsExecute(ctx context.Context, organizationId string, areaId string) (*RegionalAreaListResponse, error)
|
|
/*
|
|
V2beta1ListSnapshotsInProject 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 ApiV2beta1ListSnapshotsInProjectRequest
|
|
*/
|
|
V2beta1ListSnapshotsInProject(ctx context.Context, projectId string, region string) ApiV2beta1ListSnapshotsInProjectRequest
|
|
/*
|
|
V2beta1ListSnapshotsInProjectExecute 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
|
|
|
|
*/
|
|
V2beta1ListSnapshotsInProjectExecute(ctx context.Context, projectId string, region string) (*SnapshotListResponse, error)
|
|
/*
|
|
V2beta1UpdateBackup 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 ApiV2beta1UpdateBackupRequest
|
|
*/
|
|
V2beta1UpdateBackup(ctx context.Context, projectId string, region string, backupId string) ApiV2beta1UpdateBackupRequest
|
|
/*
|
|
V2beta1UpdateBackupExecute 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
|
|
|
|
*/
|
|
V2beta1UpdateBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error)
|
|
/*
|
|
V2beta1UpdateNetworkAreaRegion 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 ApiV2beta1UpdateNetworkAreaRegionRequest
|
|
*/
|
|
V2beta1UpdateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1UpdateNetworkAreaRegionRequest
|
|
/*
|
|
V2beta1UpdateNetworkAreaRegionExecute 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
|
|
|
|
*/
|
|
V2beta1UpdateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error)
|
|
/*
|
|
V2beta1UpdateRouteOfArea 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 ApiV2beta1UpdateRouteOfAreaRequest
|
|
*/
|
|
V2beta1UpdateRouteOfArea(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiV2beta1UpdateRouteOfAreaRequest
|
|
/*
|
|
V2beta1UpdateRouteOfAreaExecute 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
|
|
|
|
*/
|
|
V2beta1UpdateRouteOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error)
|
|
/*
|
|
V2beta1UpdateSecurityGroup 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 ApiV2beta1UpdateSecurityGroupRequest
|
|
*/
|
|
V2beta1UpdateSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiV2beta1UpdateSecurityGroupRequest
|
|
/*
|
|
V2beta1UpdateSecurityGroupExecute 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
|
|
|
|
*/
|
|
V2beta1UpdateSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error)
|
|
/*
|
|
V2beta1UpdateSnapshot 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 ApiV2beta1UpdateSnapshotRequest
|
|
*/
|
|
V2beta1UpdateSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1UpdateSnapshotRequest
|
|
/*
|
|
V2beta1UpdateSnapshotExecute 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
|
|
|
|
*/
|
|
V2beta1UpdateSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, 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 ApiCreateIsolatedNetworkRequest interface {
|
|
// Request a single isolated network creation.
|
|
CreateIsolatedNetworkPayload(createIsolatedNetworkPayload CreateIsolatedNetworkPayload) ApiCreateIsolatedNetworkRequest
|
|
Execute() (*Network, 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 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 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 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 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 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 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 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 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 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 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 ApiUpdateServerRequest interface {
|
|
// Request an update of a server.
|
|
UpdateServerPayload(updateServerPayload UpdateServerPayload) ApiUpdateServerRequest
|
|
Execute() (*Server, error)
|
|
}
|
|
|
|
type ApiUpdateVolumeRequest interface {
|
|
// Request an update of a volume.
|
|
UpdateVolumePayload(updateVolumePayload UpdateVolumePayload) ApiUpdateVolumeRequest
|
|
Execute() (*Volume, error)
|
|
}
|
|
|
|
type ApiV2beta1ConfigureNetworkAreaRegionRequest interface {
|
|
// Request to add a new regional network area configuration.
|
|
V2beta1ConfigureNetworkAreaRegionPayload(v2beta1ConfigureNetworkAreaRegionPayload V2beta1ConfigureNetworkAreaRegionPayload) ApiV2beta1ConfigureNetworkAreaRegionRequest
|
|
Execute() (*RegionalArea, error)
|
|
}
|
|
|
|
type ApiV2beta1CreateSnapshotRequest interface {
|
|
// Request a snapshot creation.
|
|
V2beta1CreateSnapshotPayload(v2beta1CreateSnapshotPayload V2beta1CreateSnapshotPayload) ApiV2beta1CreateSnapshotRequest
|
|
Execute() (*Snapshot, error)
|
|
}
|
|
|
|
type ApiV2beta1DeleteNetworkAreaRegionRequest interface {
|
|
Execute() error
|
|
}
|
|
|
|
type ApiV2beta1DeleteSnapshotRequest interface {
|
|
Execute() error
|
|
}
|
|
|
|
type ApiV2beta1GetAreaRegionRequest interface {
|
|
Execute() (*RegionalArea, error)
|
|
}
|
|
|
|
type ApiV2beta1GetSnapshotRequest interface {
|
|
Execute() (*Snapshot, error)
|
|
}
|
|
|
|
type ApiV2beta1ListAreaRegionsRequest interface {
|
|
Execute() (*RegionalAreaListResponse, error)
|
|
}
|
|
|
|
type ApiV2beta1ListSnapshotsInProjectRequest interface {
|
|
// Filter resources by labels.
|
|
LabelSelector(labelSelector string) ApiV2beta1ListSnapshotsInProjectRequest
|
|
Execute() (*SnapshotListResponse, error)
|
|
}
|
|
|
|
type ApiV2beta1UpdateBackupRequest interface {
|
|
// Request an update of a backup.
|
|
V2beta1UpdateBackupPayload(v2beta1UpdateBackupPayload V2beta1UpdateBackupPayload) ApiV2beta1UpdateBackupRequest
|
|
Execute() (*Backup, error)
|
|
}
|
|
|
|
type ApiV2beta1UpdateNetworkAreaRegionRequest interface {
|
|
// Request an update of a regional network area.
|
|
V2beta1UpdateNetworkAreaRegionPayload(v2beta1UpdateNetworkAreaRegionPayload V2beta1UpdateNetworkAreaRegionPayload) ApiV2beta1UpdateNetworkAreaRegionRequest
|
|
Execute() (*RegionalArea, error)
|
|
}
|
|
|
|
type ApiV2beta1UpdateRouteOfAreaRequest interface {
|
|
// Request an update of a network route.
|
|
V2beta1UpdateRouteOfAreaPayload(v2beta1UpdateRouteOfAreaPayload V2beta1UpdateRouteOfAreaPayload) ApiV2beta1UpdateRouteOfAreaRequest
|
|
Execute() (*Route, error)
|
|
}
|
|
|
|
type ApiV2beta1UpdateSecurityGroupRequest interface {
|
|
// Request an update of a security group.
|
|
V2beta1UpdateSecurityGroupPayload(v2beta1UpdateSecurityGroupPayload V2beta1UpdateSecurityGroupPayload) ApiV2beta1UpdateSecurityGroupRequest
|
|
Execute() (*SecurityGroup, error)
|
|
}
|
|
|
|
type ApiV2beta1UpdateSnapshotRequest interface {
|
|
// Request an update of a snapshot.
|
|
V2beta1UpdateSnapshotPayload(v2beta1UpdateSnapshotPayload V2beta1UpdateSnapshotPayload) ApiV2beta1UpdateSnapshotRequest
|
|
Execute() (*Snapshot, 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 CreateIsolatedNetworkRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
createIsolatedNetworkPayload *CreateIsolatedNetworkPayload
|
|
}
|
|
|
|
// Request a single isolated network creation.
|
|
|
|
func (r CreateIsolatedNetworkRequest) CreateIsolatedNetworkPayload(createIsolatedNetworkPayload CreateIsolatedNetworkPayload) ApiCreateIsolatedNetworkRequest {
|
|
r.createIsolatedNetworkPayload = &createIsolatedNetworkPayload
|
|
return r
|
|
}
|
|
|
|
func (r CreateIsolatedNetworkRequest) 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.CreateIsolatedNetwork")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/projects/{projectId}/regions/{region}/isolated-network"
|
|
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.createIsolatedNetworkPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("createIsolatedNetworkPayload 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.createIsolatedNetworkPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
CreateIsolatedNetwork: Create a single isolated network.
|
|
|
|
Creates an isolated network which is not connected to other networks in this project. We recommend using this endpoint only if you are fully aware of its purpose and the consequences of its execution.
|
|
|
|
@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 ApiCreateIsolatedNetworkRequest
|
|
*/
|
|
func (a *APIClient) CreateIsolatedNetwork(ctx context.Context, projectId string, region string) ApiCreateIsolatedNetworkRequest {
|
|
return CreateIsolatedNetworkRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) CreateIsolatedNetworkExecute(ctx context.Context, projectId string, region string) (*Network, error) {
|
|
r := CreateIsolatedNetworkRequest{
|
|
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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 + "/v2beta1/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 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 + "/v2beta1/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 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 + "/v2beta1/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()
|
|
}
|
|
|
|
type V2beta1ConfigureNetworkAreaRegionRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
organizationId string
|
|
areaId string
|
|
region string
|
|
v2beta1ConfigureNetworkAreaRegionPayload *V2beta1ConfigureNetworkAreaRegionPayload
|
|
}
|
|
|
|
// Request to add a new regional network area configuration.
|
|
|
|
func (r V2beta1ConfigureNetworkAreaRegionRequest) V2beta1ConfigureNetworkAreaRegionPayload(v2beta1ConfigureNetworkAreaRegionPayload V2beta1ConfigureNetworkAreaRegionPayload) ApiV2beta1ConfigureNetworkAreaRegionRequest {
|
|
r.v2beta1ConfigureNetworkAreaRegionPayload = &v2beta1ConfigureNetworkAreaRegionPayload
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1ConfigureNetworkAreaRegionRequest) 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.V2beta1ConfigureNetworkAreaRegion")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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.v2beta1ConfigureNetworkAreaRegionPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("v2beta1ConfigureNetworkAreaRegionPayload 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.v2beta1ConfigureNetworkAreaRegionPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
V2beta1ConfigureNetworkAreaRegion: 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 ApiV2beta1ConfigureNetworkAreaRegionRequest
|
|
*/
|
|
func (a *APIClient) V2beta1ConfigureNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1ConfigureNetworkAreaRegionRequest {
|
|
return V2beta1ConfigureNetworkAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1ConfigureNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) {
|
|
r := V2beta1ConfigureNetworkAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1CreateSnapshotRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
v2beta1CreateSnapshotPayload *V2beta1CreateSnapshotPayload
|
|
}
|
|
|
|
// Request a snapshot creation.
|
|
|
|
func (r V2beta1CreateSnapshotRequest) V2beta1CreateSnapshotPayload(v2beta1CreateSnapshotPayload V2beta1CreateSnapshotPayload) ApiV2beta1CreateSnapshotRequest {
|
|
r.v2beta1CreateSnapshotPayload = &v2beta1CreateSnapshotPayload
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1CreateSnapshotRequest) 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.V2beta1CreateSnapshot")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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.v2beta1CreateSnapshotPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("v2beta1CreateSnapshotPayload 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.v2beta1CreateSnapshotPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
V2beta1CreateSnapshot: 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 ApiV2beta1CreateSnapshotRequest
|
|
*/
|
|
func (a *APIClient) V2beta1CreateSnapshot(ctx context.Context, projectId string, region string) ApiV2beta1CreateSnapshotRequest {
|
|
return V2beta1CreateSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1CreateSnapshotExecute(ctx context.Context, projectId string, region string) (*Snapshot, error) {
|
|
r := V2beta1CreateSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1DeleteNetworkAreaRegionRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
organizationId string
|
|
areaId string
|
|
region string
|
|
}
|
|
|
|
func (r V2beta1DeleteNetworkAreaRegionRequest) 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.V2beta1DeleteNetworkAreaRegion")
|
|
if err != nil {
|
|
return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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
|
|
}
|
|
|
|
/*
|
|
V2beta1DeleteNetworkAreaRegion: 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 ApiV2beta1DeleteNetworkAreaRegionRequest
|
|
*/
|
|
func (a *APIClient) V2beta1DeleteNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1DeleteNetworkAreaRegionRequest {
|
|
return V2beta1DeleteNetworkAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1DeleteNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) error {
|
|
r := V2beta1DeleteNetworkAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1DeleteSnapshotRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
snapshotId string
|
|
}
|
|
|
|
func (r V2beta1DeleteSnapshotRequest) 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.V2beta1DeleteSnapshot")
|
|
if err != nil {
|
|
return &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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
|
|
}
|
|
|
|
/*
|
|
V2beta1DeleteSnapshot: 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 ApiV2beta1DeleteSnapshotRequest
|
|
*/
|
|
func (a *APIClient) V2beta1DeleteSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1DeleteSnapshotRequest {
|
|
return V2beta1DeleteSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
snapshotId: snapshotId,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1DeleteSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) error {
|
|
r := V2beta1DeleteSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
snapshotId: snapshotId,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1GetAreaRegionRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
organizationId string
|
|
areaId string
|
|
region string
|
|
}
|
|
|
|
func (r V2beta1GetAreaRegionRequest) 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.V2beta1GetAreaRegion")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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
|
|
}
|
|
|
|
/*
|
|
V2beta1GetAreaRegion: 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 ApiV2beta1GetAreaRegionRequest
|
|
*/
|
|
func (a *APIClient) V2beta1GetAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1GetAreaRegionRequest {
|
|
return V2beta1GetAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1GetAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) {
|
|
r := V2beta1GetAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1GetSnapshotRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
snapshotId string
|
|
}
|
|
|
|
func (r V2beta1GetSnapshotRequest) 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.V2beta1GetSnapshot")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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
|
|
}
|
|
|
|
/*
|
|
V2beta1GetSnapshot: 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 ApiV2beta1GetSnapshotRequest
|
|
*/
|
|
func (a *APIClient) V2beta1GetSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1GetSnapshotRequest {
|
|
return V2beta1GetSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
snapshotId: snapshotId,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1GetSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) {
|
|
r := V2beta1GetSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
snapshotId: snapshotId,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1ListAreaRegionsRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
organizationId string
|
|
areaId string
|
|
}
|
|
|
|
func (r V2beta1ListAreaRegionsRequest) 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.V2beta1ListAreaRegions")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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
|
|
}
|
|
|
|
/*
|
|
V2beta1ListAreaRegions: 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 ApiV2beta1ListAreaRegionsRequest
|
|
*/
|
|
func (a *APIClient) V2beta1ListAreaRegions(ctx context.Context, organizationId string, areaId string) ApiV2beta1ListAreaRegionsRequest {
|
|
return V2beta1ListAreaRegionsRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1ListAreaRegionsExecute(ctx context.Context, organizationId string, areaId string) (*RegionalAreaListResponse, error) {
|
|
r := V2beta1ListAreaRegionsRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1ListSnapshotsInProjectRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
labelSelector *string
|
|
}
|
|
|
|
// Filter resources by labels.
|
|
|
|
func (r V2beta1ListSnapshotsInProjectRequest) LabelSelector(labelSelector string) ApiV2beta1ListSnapshotsInProjectRequest {
|
|
r.labelSelector = &labelSelector
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1ListSnapshotsInProjectRequest) 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.V2beta1ListSnapshotsInProject")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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
|
|
}
|
|
|
|
/*
|
|
V2beta1ListSnapshotsInProject: 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 ApiV2beta1ListSnapshotsInProjectRequest
|
|
*/
|
|
func (a *APIClient) V2beta1ListSnapshotsInProject(ctx context.Context, projectId string, region string) ApiV2beta1ListSnapshotsInProjectRequest {
|
|
return V2beta1ListSnapshotsInProjectRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1ListSnapshotsInProjectExecute(ctx context.Context, projectId string, region string) (*SnapshotListResponse, error) {
|
|
r := V2beta1ListSnapshotsInProjectRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1UpdateBackupRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
backupId string
|
|
v2beta1UpdateBackupPayload *V2beta1UpdateBackupPayload
|
|
}
|
|
|
|
// Request an update of a backup.
|
|
|
|
func (r V2beta1UpdateBackupRequest) V2beta1UpdateBackupPayload(v2beta1UpdateBackupPayload V2beta1UpdateBackupPayload) ApiV2beta1UpdateBackupRequest {
|
|
r.v2beta1UpdateBackupPayload = &v2beta1UpdateBackupPayload
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1UpdateBackupRequest) 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.V2beta1UpdateBackup")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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.v2beta1UpdateBackupPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("v2beta1UpdateBackupPayload 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.v2beta1UpdateBackupPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
V2beta1UpdateBackup: 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 ApiV2beta1UpdateBackupRequest
|
|
*/
|
|
func (a *APIClient) V2beta1UpdateBackup(ctx context.Context, projectId string, region string, backupId string) ApiV2beta1UpdateBackupRequest {
|
|
return V2beta1UpdateBackupRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
backupId: backupId,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1UpdateBackupExecute(ctx context.Context, projectId string, region string, backupId string) (*Backup, error) {
|
|
r := V2beta1UpdateBackupRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
backupId: backupId,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1UpdateNetworkAreaRegionRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
organizationId string
|
|
areaId string
|
|
region string
|
|
v2beta1UpdateNetworkAreaRegionPayload *V2beta1UpdateNetworkAreaRegionPayload
|
|
}
|
|
|
|
// Request an update of a regional network area.
|
|
|
|
func (r V2beta1UpdateNetworkAreaRegionRequest) V2beta1UpdateNetworkAreaRegionPayload(v2beta1UpdateNetworkAreaRegionPayload V2beta1UpdateNetworkAreaRegionPayload) ApiV2beta1UpdateNetworkAreaRegionRequest {
|
|
r.v2beta1UpdateNetworkAreaRegionPayload = &v2beta1UpdateNetworkAreaRegionPayload
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1UpdateNetworkAreaRegionRequest) 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.V2beta1UpdateNetworkAreaRegion")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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.v2beta1UpdateNetworkAreaRegionPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("v2beta1UpdateNetworkAreaRegionPayload 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.v2beta1UpdateNetworkAreaRegionPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
V2beta1UpdateNetworkAreaRegion: 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 ApiV2beta1UpdateNetworkAreaRegionRequest
|
|
*/
|
|
func (a *APIClient) V2beta1UpdateNetworkAreaRegion(ctx context.Context, organizationId string, areaId string, region string) ApiV2beta1UpdateNetworkAreaRegionRequest {
|
|
return V2beta1UpdateNetworkAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1UpdateNetworkAreaRegionExecute(ctx context.Context, organizationId string, areaId string, region string) (*RegionalArea, error) {
|
|
r := V2beta1UpdateNetworkAreaRegionRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1UpdateRouteOfAreaRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
organizationId string
|
|
areaId string
|
|
region string
|
|
routeId string
|
|
v2beta1UpdateRouteOfAreaPayload *V2beta1UpdateRouteOfAreaPayload
|
|
}
|
|
|
|
// Request an update of a network route.
|
|
|
|
func (r V2beta1UpdateRouteOfAreaRequest) V2beta1UpdateRouteOfAreaPayload(v2beta1UpdateRouteOfAreaPayload V2beta1UpdateRouteOfAreaPayload) ApiV2beta1UpdateRouteOfAreaRequest {
|
|
r.v2beta1UpdateRouteOfAreaPayload = &v2beta1UpdateRouteOfAreaPayload
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1UpdateRouteOfAreaRequest) 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.V2beta1UpdateRouteOfArea")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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.v2beta1UpdateRouteOfAreaPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("v2beta1UpdateRouteOfAreaPayload 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.v2beta1UpdateRouteOfAreaPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
V2beta1UpdateRouteOfArea: 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 ApiV2beta1UpdateRouteOfAreaRequest
|
|
*/
|
|
func (a *APIClient) V2beta1UpdateRouteOfArea(ctx context.Context, organizationId string, areaId string, region string, routeId string) ApiV2beta1UpdateRouteOfAreaRequest {
|
|
return V2beta1UpdateRouteOfAreaRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
routeId: routeId,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1UpdateRouteOfAreaExecute(ctx context.Context, organizationId string, areaId string, region string, routeId string) (*Route, error) {
|
|
r := V2beta1UpdateRouteOfAreaRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
organizationId: organizationId,
|
|
areaId: areaId,
|
|
region: region,
|
|
routeId: routeId,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1UpdateSecurityGroupRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
securityGroupId string
|
|
v2beta1UpdateSecurityGroupPayload *V2beta1UpdateSecurityGroupPayload
|
|
}
|
|
|
|
// Request an update of a security group.
|
|
|
|
func (r V2beta1UpdateSecurityGroupRequest) V2beta1UpdateSecurityGroupPayload(v2beta1UpdateSecurityGroupPayload V2beta1UpdateSecurityGroupPayload) ApiV2beta1UpdateSecurityGroupRequest {
|
|
r.v2beta1UpdateSecurityGroupPayload = &v2beta1UpdateSecurityGroupPayload
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1UpdateSecurityGroupRequest) 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.V2beta1UpdateSecurityGroup")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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.v2beta1UpdateSecurityGroupPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("v2beta1UpdateSecurityGroupPayload 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.v2beta1UpdateSecurityGroupPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
V2beta1UpdateSecurityGroup: 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 ApiV2beta1UpdateSecurityGroupRequest
|
|
*/
|
|
func (a *APIClient) V2beta1UpdateSecurityGroup(ctx context.Context, projectId string, region string, securityGroupId string) ApiV2beta1UpdateSecurityGroupRequest {
|
|
return V2beta1UpdateSecurityGroupRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
securityGroupId: securityGroupId,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1UpdateSecurityGroupExecute(ctx context.Context, projectId string, region string, securityGroupId string) (*SecurityGroup, error) {
|
|
r := V2beta1UpdateSecurityGroupRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
securityGroupId: securityGroupId,
|
|
}
|
|
return r.Execute()
|
|
}
|
|
|
|
type V2beta1UpdateSnapshotRequest struct {
|
|
ctx context.Context
|
|
apiService *DefaultApiService
|
|
projectId string
|
|
region string
|
|
snapshotId string
|
|
v2beta1UpdateSnapshotPayload *V2beta1UpdateSnapshotPayload
|
|
}
|
|
|
|
// Request an update of a snapshot.
|
|
|
|
func (r V2beta1UpdateSnapshotRequest) V2beta1UpdateSnapshotPayload(v2beta1UpdateSnapshotPayload V2beta1UpdateSnapshotPayload) ApiV2beta1UpdateSnapshotRequest {
|
|
r.v2beta1UpdateSnapshotPayload = &v2beta1UpdateSnapshotPayload
|
|
return r
|
|
}
|
|
|
|
func (r V2beta1UpdateSnapshotRequest) 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.V2beta1UpdateSnapshot")
|
|
if err != nil {
|
|
return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/v2beta1/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.v2beta1UpdateSnapshotPayload == nil {
|
|
return localVarReturnValue, fmt.Errorf("v2beta1UpdateSnapshotPayload 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.v2beta1UpdateSnapshotPayload
|
|
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
|
|
}
|
|
|
|
/*
|
|
V2beta1UpdateSnapshot: 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 ApiV2beta1UpdateSnapshotRequest
|
|
*/
|
|
func (a *APIClient) V2beta1UpdateSnapshot(ctx context.Context, projectId string, region string, snapshotId string) ApiV2beta1UpdateSnapshotRequest {
|
|
return V2beta1UpdateSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
snapshotId: snapshotId,
|
|
}
|
|
}
|
|
|
|
func (a *APIClient) V2beta1UpdateSnapshotExecute(ctx context.Context, projectId string, region string, snapshotId string) (*Snapshot, error) {
|
|
r := V2beta1UpdateSnapshotRequest{
|
|
apiService: a.defaultApi,
|
|
ctx: ctx,
|
|
projectId: projectId,
|
|
region: region,
|
|
snapshotId: snapshotId,
|
|
}
|
|
return r.Execute()
|
|
}
|