diff --git a/README.md b/README.md index 069603a..87117eb 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/IBM/vpc-go-sdk) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -# IBM Cloud VPC Go SDK Version 0.21.0 +# IBM Cloud VPC Go SDK Version 0.22.0 Go client library to interact with the various [IBM Cloud VPC Services APIs](https://cloud.ibm.com/apidocs?category=vpc). **Note:** Given the current version of all VPC SDKs across supported languages and the current VPC API specification, we retracted the vpc-go-sdk version 1.x to version v0.6.0, which had the same features as v1.0.1. -Consider using v0.21.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` on go 1.14 and lower as you will not get the latest release. +Consider using v0.22.0 from now on. Refrain from using commands like `go get -u ..` and `go get ..@latest` on go 1.14 and lower as you will not get the latest release. This SDK uses [Semantic Versioning](https://semver.org), and as such there may be backward-incompatible changes for any new `0.y.z` version. ## Table of Contents @@ -64,7 +64,7 @@ Use this command to download and install the VPC Go SDK service to allow your Go use it: ``` -go get github.com/IBM/vpc-go-sdk@v0.21.0 +go get github.com/IBM/vpc-go-sdk@v0.22.0 ``` @@ -90,7 +90,7 @@ to your `Gopkg.toml` file. Here is an example: ``` [[constraint]] name = "github.com/IBM/vpc-go-sdk/" - version = "0.21.0" + version = "0.22.0" ``` Then run `dep ensure`. diff --git a/common/version.go b/common/version.go index beecdcc..8e10adb 100644 --- a/common/version.go +++ b/common/version.go @@ -1,4 +1,4 @@ package common // Version of the SDK -const Version = "0.21.0" +const Version = "0.22.0" diff --git a/vpcv1/vpc_v1.go b/vpcv1/vpc_v1.go index b4d1366..4c94556 100644 --- a/vpcv1/vpc_v1.go +++ b/vpcv1/vpc_v1.go @@ -1517,6 +1517,9 @@ func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVP builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) + if createVPCRoutingTableOptions.AcceptRoutesFrom != nil { + body["accept_routes_from"] = createVPCRoutingTableOptions.AcceptRoutesFrom + } if createVPCRoutingTableOptions.Name != nil { body["name"] = createVPCRoutingTableOptions.Name } @@ -1597,6 +1600,9 @@ func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVP for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + if deleteVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPCRoutingTableOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -1716,6 +1722,9 @@ func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVP } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPCRoutingTableOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPCRoutingTableOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -11123,136 +11132,6 @@ func (vpc *VpcV1) AddBareMetalServerNetworkInterfaceFloatingIPWithContext(ctx co return } -// ListBareMetalServerNetworkInterfaceIps : List all reserved IPs bound to a network interface -// This request lists all reserved IPs bound to a network interface. -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { - return vpc.ListBareMetalServerNetworkInterfaceIpsWithContext(context.Background(), listBareMetalServerNetworkInterfaceIpsOptions) -} - -// ListBareMetalServerNetworkInterfaceIpsWithContext is an alternate form of the ListBareMetalServerNetworkInterfaceIps method which supports a Context parameter -func (vpc *VpcV1) ListBareMetalServerNetworkInterfaceIpsWithContext(ctx context.Context, listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) (result *ReservedIPCollectionNetworkInterfaceContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listBareMetalServerNetworkInterfaceIpsOptions, "listBareMetalServerNetworkInterfaceIpsOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *listBareMetalServerNetworkInterfaceIpsOptions.BareMetalServerID, - "network_interface_id": *listBareMetalServerNetworkInterfaceIpsOptions.NetworkInterfaceID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range listBareMetalServerNetworkInterfaceIpsOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListBareMetalServerNetworkInterfaceIps") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionNetworkInterfaceContext) - if err != nil { - return - } - response.Result = result - } - - return -} - -// GetBareMetalServerNetworkInterfaceIP : Retrieve bound reserved IP -// This request a retrieves the specified reserved IP address if it is bound to the network interface and bare metal -// server specified in the URL. -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetBareMetalServerNetworkInterfaceIPWithContext(context.Background(), getBareMetalServerNetworkInterfaceIPOptions) -} - -// GetBareMetalServerNetworkInterfaceIPWithContext is an alternate form of the GetBareMetalServerNetworkInterfaceIP method which supports a Context parameter -func (vpc *VpcV1) GetBareMetalServerNetworkInterfaceIPWithContext(ctx context.Context, getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(getBareMetalServerNetworkInterfaceIPOptions, "getBareMetalServerNetworkInterfaceIPOptions") - if err != nil { - return - } - - pathParamsMap := map[string]string{ - "bare_metal_server_id": *getBareMetalServerNetworkInterfaceIPOptions.BareMetalServerID, - "network_interface_id": *getBareMetalServerNetworkInterfaceIPOptions.NetworkInterfaceID, - "id": *getBareMetalServerNetworkInterfaceIPOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/bare_metal_servers/{bare_metal_server_id}/network_interfaces/{network_interface_id}/ips/{id}`, pathParamsMap) - if err != nil { - return - } - - for headerName, headerValue := range getBareMetalServerNetworkInterfaceIPOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetBareMetalServerNetworkInterfaceIP") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - - builder.AddQuery("version", fmt.Sprint(*vpc.Version)) - builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - request, err := builder.Build() - if err != nil { - return - } - - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) - if err != nil { - return - } - response.Result = result - } - - return -} - // DeleteBareMetalServer : Delete a bare metal server // This request deletes a bare metal server. This operation cannot be reversed. Any floating IPs associated with the // bare metal server's network interfaces are implicitly disassociated. @@ -14804,6 +14683,7 @@ func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listS // least one other security group. The specified target identifier can be: // // - A network interface identifier +// - A VPN server identifier // - An application load balancer identifier // - An endpoint gateway identifier // @@ -14928,6 +14808,7 @@ func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecu // This request adds a resource to an existing security group. The specified target identifier can be: // // - A network interface identifier +// - A VPN server identifier // - An application load balancer identifier // - An endpoint gateway identifier // @@ -16423,6 +16304,8 @@ func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, upd // ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection // This request lists all local CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) } @@ -16487,6 +16370,8 @@ func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Cont // RemoveVPNGatewayConnectionLocalCIDR : Remove a local CIDR from a VPN gateway connection // This request removes a CIDR from a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) } @@ -16540,7 +16425,9 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Con } // CheckVPNGatewayConnectionLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection and fails otherwise. +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) } @@ -16594,8 +16481,10 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Cont } // AddVPNGatewayConnectionLocalCIDR : Set a local CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. A request body is not required, and if -// provided, is ignored. This request succeeds if the CIDR already exists on the specified VPN gateway connection. +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) } @@ -16650,6 +16539,8 @@ func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Contex // ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection // This request lists all peer CIDRs for a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) } @@ -16714,6 +16605,8 @@ func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Conte // RemoveVPNGatewayConnectionPeerCIDR : Remove a peer CIDR from a VPN gateway connection // This request removes a CIDR from a VPN gateway connection. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) } @@ -16767,7 +16660,9 @@ func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Cont } // CheckVPNGatewayConnectionPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection -// This request succeeds if a CIDR exists on the specified VPN gateway connection and fails otherwise. +// This request succeeds if a CIDR exists on the specified VPN gateway connection, and fails otherwise. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) } @@ -16821,8 +16716,10 @@ func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Conte } // AddVPNGatewayConnectionPeerCIDR : Set a peer CIDR on a VPN gateway connection -// This request adds the specified CIDR to the specified VPN gateway connection. A request body is not required, and if -// provided, is ignored. This request succeeds if the CIDR already exists on the specified VPN gateway connection. +// This request adds the specified CIDR to the specified VPN gateway connection. This request succeeds if the specified +// CIDR already exists. A request body is not required, and if provided, is ignored. +// +// This request is only supported for policy mode VPN gateways. func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) } @@ -16875,16 +16772,15 @@ func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context return } -// ListLoadBalancerProfiles : List all load balancer profiles -// This request lists all load balancer profiles available in the region. A load balancer profile specifies the -// performance characteristics and pricing model for a load balancer. -func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +// ListVPNServers : List all VPN servers +// This request lists all VPN servers. +func (vpc *VpcV1) ListVPNServers(listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServersWithContext(context.Background(), listVPNServersOptions) } -// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") +// ListVPNServersWithContext is an alternate form of the ListVPNServers method which supports a Context parameter +func (vpc *VpcV1) ListVPNServersWithContext(ctx context.Context, listVPNServersOptions *ListVPNServersOptions) (result *VPNServerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNServersOptions, "listVPNServersOptions") if err != nil { return } @@ -16892,16 +16788,16 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { return } - for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + for headerName, headerValue := range listVPNServersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -16909,11 +16805,20 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listLoadBalancerProfilesOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + if listVPNServersOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVPNServersOptions.Name)) } - if listLoadBalancerProfilesOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + if listVPNServersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServersOptions.Start)) + } + if listVPNServersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServersOptions.Limit)) + } + if listVPNServersOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNServersOptions.ResourceGroupID)) + } + if listVPNServersOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServersOptions.Sort)) } request, err := builder.Build() @@ -16927,7 +16832,7 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerCollection) if err != nil { return } @@ -16937,48 +16842,87 @@ func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listL return } -// GetLoadBalancerProfile : Retrieve a load balancer profile -// This request retrieves a load balancer profile specified by the name in the URL. -func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +// CreateVPNServer : Create a VPN server +// This request creates a new VPN server. +func (vpc *VpcV1) CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerWithContext(context.Background(), createVPNServerOptions) } -// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") +// CreateVPNServerWithContext is an alternate form of the CreateVPNServer method which supports a Context parameter +func (vpc *VpcV1) CreateVPNServerWithContext(ctx context.Context, createVPNServerOptions *CreateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNServerOptions, "createVPNServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + err = core.ValidateStruct(createVPNServerOptions, "createVPNServerOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "name": *getLoadBalancerProfileOptions.Name, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers`, nil) if err != nil { return } - for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + for headerName, headerValue := range createVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createVPNServerOptions.Certificate != nil { + body["certificate"] = createVPNServerOptions.Certificate + } + if createVPNServerOptions.ClientAuthentication != nil { + body["client_authentication"] = createVPNServerOptions.ClientAuthentication + } + if createVPNServerOptions.ClientIPPool != nil { + body["client_ip_pool"] = createVPNServerOptions.ClientIPPool + } + if createVPNServerOptions.Subnets != nil { + body["subnets"] = createVPNServerOptions.Subnets + } + if createVPNServerOptions.ClientDnsServerIps != nil { + body["client_dns_server_ips"] = createVPNServerOptions.ClientDnsServerIps + } + if createVPNServerOptions.ClientIdleTimeout != nil { + body["client_idle_timeout"] = createVPNServerOptions.ClientIdleTimeout + } + if createVPNServerOptions.EnableSplitTunneling != nil { + body["enable_split_tunneling"] = createVPNServerOptions.EnableSplitTunneling + } + if createVPNServerOptions.Name != nil { + body["name"] = createVPNServerOptions.Name + } + if createVPNServerOptions.Port != nil { + body["port"] = createVPNServerOptions.Port + } + if createVPNServerOptions.Protocol != nil { + body["protocol"] = createVPNServerOptions.Protocol + } + if createVPNServerOptions.ResourceGroup != nil { + body["resource_group"] = createVPNServerOptions.ResourceGroup + } + if createVPNServerOptions.SecurityGroups != nil { + body["security_groups"] = createVPNServerOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -16990,7 +16934,7 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -17000,46 +16944,102 @@ func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoad return } -// ListLoadBalancers : List all load balancers -// This request lists all load balancers in the region. -func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +// DeleteVPNServer : Delete a VPN server +// This request deletes a VPN server. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerWithContext(context.Background(), deleteVPNServerOptions) } -// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") +// DeleteVPNServerWithContext is an alternate form of the DeleteVPNServer method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerWithContext(ctx context.Context, deleteVPNServerOptions *DeleteVPNServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerOptions, "deleteVPNServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNServerOptions, "deleteVPNServerOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *deleteVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancersOptions.Headers { + for headerName, headerValue := range deleteVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") + if deleteVPNServerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*deleteVPNServerOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listLoadBalancersOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) + + request, err := builder.Build() + if err != nil { + return } - if listLoadBalancersOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNServer : Retrieve a VPN server +// This request retrieves a single VPN server specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServer(getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerWithContext(context.Background(), getVPNServerOptions) +} + +// GetVPNServerWithContext is an alternate form of the GetVPNServer method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerWithContext(ctx context.Context, getVPNServerOptions *GetVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerOptions, "getVPNServerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNServerOptions, "getVPNServerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNServerOptions.Headers { + builder.AddHeader(headerName, headerValue) } + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + request, err := builder.Build() if err != nil { return @@ -17051,7 +17051,7 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -17061,77 +17061,54 @@ func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBala return } -// CreateLoadBalancer : Create a load balancer -// This request creates and provisions a new load balancer. -func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +// UpdateVPNServer : Update a VPN server +// This request updates the properties of an existing VPN server. Any property changes will cause all connected VPN +// clients are disconnected from this VPN server except for the name change. +func (vpc *VpcV1) UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerWithContext(context.Background(), updateVPNServerOptions) } -// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") +// UpdateVPNServerWithContext is an alternate form of the UpdateVPNServer method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNServerWithContext(ctx context.Context, updateVPNServerOptions *UpdateVPNServerOptions) (result *VPNServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNServerOptions, "updateVPNServerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + err = core.ValidateStruct(updateVPNServerOptions, "updateVPNServerOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *updateVPNServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerOptions.Headers { + for headerName, headerValue := range updateVPNServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateVPNServerOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateVPNServerOptions.IfMatch)) + } builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerOptions.IsPublic != nil { - body["is_public"] = createLoadBalancerOptions.IsPublic - } - if createLoadBalancerOptions.Subnets != nil { - body["subnets"] = createLoadBalancerOptions.Subnets - } - if createLoadBalancerOptions.Listeners != nil { - body["listeners"] = createLoadBalancerOptions.Listeners - } - if createLoadBalancerOptions.Logging != nil { - body["logging"] = createLoadBalancerOptions.Logging - } - if createLoadBalancerOptions.Name != nil { - body["name"] = createLoadBalancerOptions.Name - } - if createLoadBalancerOptions.Pools != nil { - body["pools"] = createLoadBalancerOptions.Pools - } - if createLoadBalancerOptions.Profile != nil { - body["profile"] = createLoadBalancerOptions.Profile - } - if createLoadBalancerOptions.ResourceGroup != nil { - body["resource_group"] = createLoadBalancerOptions.ResourceGroup - } - if createLoadBalancerOptions.RouteMode != nil { - body["route_mode"] = createLoadBalancerOptions.RouteMode - } - if createLoadBalancerOptions.SecurityGroups != nil { - body["security_groups"] = createLoadBalancerOptions.SecurityGroups - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateVPNServerOptions.VPNServerPatch) if err != nil { return } @@ -17147,7 +17124,7 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServer) if err != nil { return } @@ -17157,44 +17134,45 @@ func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadB return } -// DeleteLoadBalancer : Delete a load balancer -// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its -// `provisioning_status` is `delete_pending`. -func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +// GetVPNServerClientConfiguration : Retrieve client configuration +// This request retrieves OpenVPN client configuration on a single VPN server specified by the identifier in the URL. +// This configuration includes directives compatible with OpenVPN releases 2.4 and 2.5. +func (vpc *VpcV1) GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerClientConfigurationWithContext(context.Background(), getVPNServerClientConfigurationOptions) } -// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") +// GetVPNServerClientConfigurationWithContext is an alternate form of the GetVPNServerClientConfiguration method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientConfigurationWithContext(ctx context.Context, getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions) (result *string, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + err = core.ValidateStruct(getVPNServerClientConfigurationOptions, "getVPNServerClientConfigurationOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteLoadBalancerOptions.ID, + "id": *getVPNServerClientConfigurationOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{id}/client_configuration`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + for headerName, headerValue := range getVPNServerClientConfigurationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClientConfiguration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "text/plain") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -17204,45 +17182,46 @@ func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadB return } - response, err = vpc.Service.Request(request, nil) + response, err = vpc.Service.Request(request, &result) return } -// GetLoadBalancer : Retrieve a load balancer -// This request retrieves a single load balancer specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +// ListVPNServerClients : List all VPN clients for a VPN server +// This request retrieves all connected VPN clients, and any disconnected VPN clients that the VPN server has not yet +// deleted based on its auto-deletion policy. +func (vpc *VpcV1) ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServerClientsWithContext(context.Background(), listVPNServerClientsOptions) } -// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") +// ListVPNServerClientsWithContext is an alternate form of the ListVPNServerClients method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerClientsWithContext(ctx context.Context, listVPNServerClientsOptions *ListVPNServerClientsOptions) (result *VPNServerClientCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerClientsOptions, "listVPNServerClientsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + err = core.ValidateStruct(listVPNServerClientsOptions, "listVPNServerClientsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerOptions.ID, + "vpn_server_id": *listVPNServerClientsOptions.VPNServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerOptions.Headers { + for headerName, headerValue := range listVPNServerClientsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerClients") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17250,6 +17229,15 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNServerClientsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerClientsOptions.Start)) + } + if listVPNServerClientsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerClientsOptions.Limit)) + } + if listVPNServerClientsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerClientsOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -17262,7 +17250,7 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClientCollection) if err != nil { return } @@ -17272,54 +17260,103 @@ func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalance return } -// UpdateLoadBalancer : Update a load balancer -// This request updates a load balancer. -func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +// DeleteVPNServerClient : Delete a VPN client +// This request disconnects and deletes the VPN client from the VPN server. The VPN client may reconnect unless its +// authentication permissions for the configured authentication methods (such as its client certificate) have been +// revoked. +func (vpc *VpcV1) DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerClientWithContext(context.Background(), deleteVPNServerClientOptions) } -// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") +// DeleteVPNServerClientWithContext is an alternate form of the DeleteVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerClientWithContext(ctx context.Context, deleteVPNServerClientOptions *DeleteVPNServerClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerClientOptions, "deleteVPNServerClientOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + err = core.ValidateStruct(deleteVPNServerClientOptions, "deleteVPNServerClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateLoadBalancerOptions.ID, + "vpn_server_id": *deleteVPNServerClientOptions.VPNServerID, + "id": *deleteVPNServerClientOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerOptions.Headers { + for headerName, headerValue := range deleteVPNServerClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNServerClient : Retrieve a VPN client +// This request retrieves a single VPN client specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerClientWithContext(context.Background(), getVPNServerClientOptions) +} + +// GetVPNServerClientWithContext is an alternate form of the GetVPNServerClient method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerClientWithContext(ctx context.Context, getVPNServerClientOptions *GetVPNServerClientOptions) (result *VPNServerClient, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerClientOptions, "getVPNServerClientOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNServerClientOptions, "getVPNServerClientOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_server_id": *getVPNServerClientOptions.VPNServerID, + "id": *getVPNServerClientOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}`, pathParamsMap) if err != nil { return } + for headerName, headerValue := range getVPNServerClientOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerClient") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + request, err := builder.Build() if err != nil { return @@ -17331,7 +17368,7 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerClient) if err != nil { return } @@ -17341,44 +17378,46 @@ func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadB return } -// GetLoadBalancerStatistics : List all statistics of a load balancer -// This request lists statistics of a load balancer. -func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +// DisconnectVPNClient : Disconnect a VPN client +// This request disconnects the specified VPN client, and deletes the client according to the VPN server's auto-deletion +// policy. The VPN client may reconnect unless its authentication permissions for the configured authentication methods +// (such as its client certificate) have been revoked. +func (vpc *VpcV1) DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + return vpc.DisconnectVPNClientWithContext(context.Background(), disconnectVPNClientOptions) } -// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") +// DisconnectVPNClientWithContext is an alternate form of the DisconnectVPNClient method which supports a Context parameter +func (vpc *VpcV1) DisconnectVPNClientWithContext(ctx context.Context, disconnectVPNClientOptions *DisconnectVPNClientOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(disconnectVPNClientOptions, "disconnectVPNClientOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + err = core.ValidateStruct(disconnectVPNClientOptions, "disconnectVPNClientOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getLoadBalancerStatisticsOptions.ID, + "vpn_server_id": *disconnectVPNClientOptions.VPNServerID, + "id": *disconnectVPNClientOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/clients/{id}/disconnect`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + for headerName, headerValue := range disconnectVPNClientOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DisconnectVPNClient") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -17388,56 +17427,47 @@ func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getL return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListLoadBalancerListeners : List all listeners for a load balancer -// This request lists all listeners for a load balancer. -func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) +// ListVPNServerRoutes : List all VPN routes for a VPN server +// This request lists all VPN routes in a VPN server. All VPN routes are provided to the VPN client when the connection +// is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN route +// matching their specified destinations. All VPN routes must be unique within the VPN server. +func (vpc *VpcV1) ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNServerRoutesWithContext(context.Background(), listVPNServerRoutesOptions) } -// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") +// ListVPNServerRoutesWithContext is an alternate form of the ListVPNServerRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPNServerRoutesWithContext(ctx context.Context, listVPNServerRoutesOptions *ListVPNServerRoutesOptions) (result *VPNServerRouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNServerRoutesOptions, "listVPNServerRoutesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + err = core.ValidateStruct(listVPNServerRoutesOptions, "listVPNServerRoutesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + "vpn_server_id": *listVPNServerRoutesOptions.VPNServerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { + for headerName, headerValue := range listVPNServerRoutesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNServerRoutes") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17445,6 +17475,15 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNServerRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNServerRoutesOptions.Start)) + } + if listVPNServerRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNServerRoutesOptions.Limit)) + } + if listVPNServerRoutesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listVPNServerRoutesOptions.Sort)) + } request, err := builder.Build() if err != nil { @@ -17457,7 +17496,7 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRouteCollection) if err != nil { return } @@ -17467,40 +17506,43 @@ func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, list return } -// CreateLoadBalancerListener : Create a listener for a load balancer -// This request creates a new listener for a load balancer. -func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) +// CreateVPNServerRoute : Create a VPN route for a VPN server +// This request creates a new VPN route in the VPN server. All VPN routes are provided to the VPN client when the +// connection is established. Packets received from the VPN client will be dropped by the VPN server if there is no VPN +// route matching their specified destinations. All VPN routes must be unique within the VPN server. destination of the +// packet. +func (vpc *VpcV1) CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.CreateVPNServerRouteWithContext(context.Background(), createVPNServerRouteOptions) } -// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") +// CreateVPNServerRouteWithContext is an alternate form of the CreateVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPNServerRouteWithContext(ctx context.Context, createVPNServerRouteOptions *CreateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNServerRouteOptions, "createVPNServerRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + err = core.ValidateStruct(createVPNServerRouteOptions, "createVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, + "vpn_server_id": *createVPNServerRouteOptions.VPNServerID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range createVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17511,35 +17553,14 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) - if createLoadBalancerListenerOptions.Protocol != nil { - body["protocol"] = createLoadBalancerListenerOptions.Protocol - } - if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { - body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol - } - if createLoadBalancerListenerOptions.CertificateInstance != nil { - body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance - } - if createLoadBalancerListenerOptions.ConnectionLimit != nil { - body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit - } - if createLoadBalancerListenerOptions.DefaultPool != nil { - body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool - } - if createLoadBalancerListenerOptions.HTTPSRedirect != nil { - body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect - } - if createLoadBalancerListenerOptions.Policies != nil { - body["policies"] = createLoadBalancerListenerOptions.Policies - } - if createLoadBalancerListenerOptions.Port != nil { - body["port"] = createLoadBalancerListenerOptions.Port + if createVPNServerRouteOptions.Destination != nil { + body["destination"] = createVPNServerRouteOptions.Destination } - if createLoadBalancerListenerOptions.PortMax != nil { - body["port_max"] = createLoadBalancerListenerOptions.PortMax + if createVPNServerRouteOptions.Action != nil { + body["action"] = createVPNServerRouteOptions.Action } - if createLoadBalancerListenerOptions.PortMin != nil { - body["port_min"] = createLoadBalancerListenerOptions.PortMin + if createVPNServerRouteOptions.Name != nil { + body["name"] = createVPNServerRouteOptions.Name } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -17557,7 +17578,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { return } @@ -17567,42 +17588,41 @@ func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, cre return } -// DeleteLoadBalancerListener : Delete a load balancer listener -// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the -// listener must not be the target of another load balancer listener. -func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +// DeleteVPNServerRoute : Delete a VPN route +// This request deletes a VPN route. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNServerRouteWithContext(context.Background(), deleteVPNServerRouteOptions) } -// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") +// DeleteVPNServerRouteWithContext is an alternate form of the DeleteVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNServerRouteWithContext(ctx context.Context, deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + err = core.ValidateStruct(deleteVPNServerRouteOptions, "deleteVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, - "id": *deleteLoadBalancerListenerOptions.ID, + "vpn_server_id": *deleteVPNServerRouteOptions.VPNServerID, + "id": *deleteVPNServerRouteOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range deleteVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17620,41 +17640,41 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, del return } -// GetLoadBalancerListener : Retrieve a load balancer listener -// This request retrieves a single listener specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +// GetVPNServerRoute : Retrieve a VPN route +// This request retrieves a single VPN route specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.GetVPNServerRouteWithContext(context.Background(), getVPNServerRouteOptions) } -// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") +// GetVPNServerRouteWithContext is an alternate form of the GetVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPNServerRouteWithContext(ctx context.Context, getVPNServerRouteOptions *GetVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNServerRouteOptions, "getVPNServerRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + err = core.ValidateStruct(getVPNServerRouteOptions, "getVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, - "id": *getLoadBalancerListenerOptions.ID, + "vpn_server_id": *getVPNServerRouteOptions.VPNServerID, + "id": *getVPNServerRouteOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range getVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17674,7 +17694,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { return } @@ -17684,41 +17704,42 @@ func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoa return } -// UpdateLoadBalancerListener : Update a load balancer listener -// This request updates a load balancer listener from a listener patch. -func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +// UpdateVPNServerRoute : Update a VPN route +// This request updates a VPN route with the information in a provided VPN route patch. The VPN route patch object is +// structured in the same way as a retrieved VPN route and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNServerRouteWithContext(context.Background(), updateVPNServerRouteOptions) } -// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") +// UpdateVPNServerRouteWithContext is an alternate form of the UpdateVPNServerRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNServerRouteWithContext(ctx context.Context, updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) (result *VPNServerRoute, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNServerRouteOptions, "updateVPNServerRouteOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + err = core.ValidateStruct(updateVPNServerRouteOptions, "updateVPNServerRouteOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, - "id": *updateLoadBalancerListenerOptions.ID, + "vpn_server_id": *updateVPNServerRouteOptions.VPNServerID, + "id": *updateVPNServerRouteOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_servers/{vpn_server_id}/routes/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + for headerName, headerValue := range updateVPNServerRouteOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNServerRoute") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17728,7 +17749,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + _, err = builder.SetBodyContentJSON(updateVPNServerRouteOptions.VPNServerRoutePatch) if err != nil { return } @@ -17744,7 +17765,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNServerRoute) if err != nil { return } @@ -17754,41 +17775,33 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, upd return } -// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener -// This request lists all policies for a load balancer listener. -func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +// ListLoadBalancerProfiles : List all load balancer profiles +// This request lists all load balancer profiles available in the region. A load balancer profile specifies the +// performance characteristics and pricing model for a load balancer. +func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) } -// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") +// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -17796,6 +17809,12 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listLoadBalancerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + } + if listLoadBalancerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + } request, err := builder.Build() if err != nil { @@ -17808,7 +17827,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) if err != nil { return } @@ -17818,71 +17837,48 @@ func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Contex return } -// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener -// Creates a new policy for a load balancer listener. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +// GetLoadBalancerProfile : Retrieve a load balancer profile +// This request retrieves a load balancer profile specified by the name in the URL. +func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) } -// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") +// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, + "name": *getLoadBalancerProfileOptions.Name, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyOptions.Action != nil { - body["action"] = createLoadBalancerListenerPolicyOptions.Action - } - if createLoadBalancerListenerPolicyOptions.Priority != nil { - body["priority"] = createLoadBalancerListenerPolicyOptions.Priority - } - if createLoadBalancerListenerPolicyOptions.Name != nil { - body["name"] = createLoadBalancerListenerPolicyOptions.Name - } - if createLoadBalancerListenerPolicyOptions.Rules != nil { - body["rules"] = createLoadBalancerListenerPolicyOptions.Rules - } - if createLoadBalancerListenerPolicyOptions.Target != nil { - body["target"] = createLoadBalancerListenerPolicyOptions.Target - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -17894,7 +17890,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) if err != nil { return } @@ -17904,103 +17900,142 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Contex return } -// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy -// Deletes a policy of the load balancer listener. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +// ListLoadBalancers : List all load balancers +// This request lists all load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) } -// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") +// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, - "id": *deleteLoadBalancerListenerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range listLoadBalancersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listLoadBalancersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancersOptions.Start)) + } + if listLoadBalancersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancersOptions.Limit)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy -// Retrieve a single policy specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +// CreateLoadBalancer : Create a load balancer +// This request creates and provisions a new load balancer. +func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) } -// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") +// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, - "id": *getLoadBalancerListenerPolicyOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range createLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createLoadBalancerOptions.IsPublic != nil { + body["is_public"] = createLoadBalancerOptions.IsPublic + } + if createLoadBalancerOptions.Subnets != nil { + body["subnets"] = createLoadBalancerOptions.Subnets + } + if createLoadBalancerOptions.Listeners != nil { + body["listeners"] = createLoadBalancerOptions.Listeners + } + if createLoadBalancerOptions.Logging != nil { + body["logging"] = createLoadBalancerOptions.Logging + } + if createLoadBalancerOptions.Name != nil { + body["name"] = createLoadBalancerOptions.Name + } + if createLoadBalancerOptions.Pools != nil { + body["pools"] = createLoadBalancerOptions.Pools + } + if createLoadBalancerOptions.Profile != nil { + body["profile"] = createLoadBalancerOptions.Profile + } + if createLoadBalancerOptions.ResourceGroup != nil { + body["resource_group"] = createLoadBalancerOptions.ResourceGroup + } + if createLoadBalancerOptions.RouteMode != nil { + body["route_mode"] = createLoadBalancerOptions.RouteMode + } + if createLoadBalancerOptions.SecurityGroups != nil { + body["security_groups"] = createLoadBalancerOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -18012,7 +18047,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -18022,113 +18057,92 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, return } -// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy -// Updates a policy from a policy patch. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +// DeleteLoadBalancer : Delete a load balancer +// This request deletes a load balancer. This operation cannot be reversed. A load balancer cannot be deleted if its +// `provisioning_status` is `delete_pending`. +func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) } -// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") +// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, - "id": *updateLoadBalancerListenerPolicyOptions.ID, + "id": *deleteLoadBalancerOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy -// This request lists all rules of a load balancer listener policy. -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) +// GetLoadBalancer : Retrieve a load balancer +// This request retrieves a single load balancer specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) } -// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") +// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, - "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, - "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + "id": *getLoadBalancerOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + for headerName, headerValue := range getLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18148,7 +18162,7 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -18158,65 +18172,50 @@ func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Con return } -// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy -// Creates a new rule for the load balancer listener policy. -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +// UpdateLoadBalancer : Update a load balancer +// This request updates a load balancer. +func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) } -// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") +// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range updateLoadBalancerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { - body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition - } - if createLoadBalancerListenerPolicyRuleOptions.Type != nil { - body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type - } - if createLoadBalancerListenerPolicyRuleOptions.Value != nil { - body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value - } - if createLoadBalancerListenerPolicyRuleOptions.Field != nil { - body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) if err != nil { return } @@ -18232,7 +18231,7 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) if err != nil { return } @@ -18242,46 +18241,44 @@ func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule -// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +// GetLoadBalancerStatistics : List all statistics of a load balancer +// This request lists statistics of a load balancer. +func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) } -// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") +// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, + "id": *getLoadBalancerStatisticsOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -18291,48 +18288,56 @@ func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) + if err != nil { + return + } + response.Result = result + } return } -// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule -// Retrieves a single rule specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +// ListLoadBalancerListeners : List all listeners for a load balancer +// This request lists all listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) } -// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") +// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *getLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18352,7 +18357,7 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) if err != nil { return } @@ -18362,53 +18367,81 @@ func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Conte return } -// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule -// Updates a rule of the load balancer listener policy. -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +// CreateLoadBalancerListener : Create a listener for a load balancer +// This request creates a new listener for a load balancer. +func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) } -// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") +// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, - "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, - "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, - "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + body := make(map[string]interface{}) + if createLoadBalancerListenerOptions.Protocol != nil { + body["protocol"] = createLoadBalancerListenerOptions.Protocol + } + if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { + body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol + } + if createLoadBalancerListenerOptions.CertificateInstance != nil { + body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance + } + if createLoadBalancerListenerOptions.ConnectionLimit != nil { + body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit + } + if createLoadBalancerListenerOptions.DefaultPool != nil { + body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool + } + if createLoadBalancerListenerOptions.HTTPSRedirect != nil { + body["https_redirect"] = createLoadBalancerListenerOptions.HTTPSRedirect + } + if createLoadBalancerListenerOptions.Policies != nil { + body["policies"] = createLoadBalancerListenerOptions.Policies + } + if createLoadBalancerListenerOptions.Port != nil { + body["port"] = createLoadBalancerListenerOptions.Port + } + if createLoadBalancerListenerOptions.PortMax != nil { + body["port_max"] = createLoadBalancerListenerOptions.PortMax + } + if createLoadBalancerListenerOptions.PortMin != nil { + body["port_min"] = createLoadBalancerListenerOptions.PortMin + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } @@ -18424,7 +18457,7 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -18434,44 +18467,45 @@ func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Co return } -// ListLoadBalancerPools : List all pools of a load balancer -// This request lists all pools of a load balancer. -func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +// DeleteLoadBalancerListener : Delete a load balancer listener +// This request deletes a load balancer listener. This operation cannot be reversed. For this operation to succeed, the +// listener must not be the target of another load balancer listener. +func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) } -// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") +// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, + "id": *deleteLoadBalancerListenerOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -18481,88 +18515,120 @@ func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoad return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// CreateLoadBalancerPool : Create a load balancer pool -// This request creates a new pool from a pool prototype object. -func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +// GetLoadBalancerListener : Retrieve a load balancer listener +// This request retrieves a single listener specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) } -// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") - if err != nil { +// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") + if err != nil { return } - err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, + "id": *getLoadBalancerListenerOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerPoolOptions.Algorithm != nil { - body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + request, err := builder.Build() + if err != nil { + return } - if createLoadBalancerPoolOptions.HealthMonitor != nil { - body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return } - if createLoadBalancerPoolOptions.Protocol != nil { - body["protocol"] = createLoadBalancerPoolOptions.Protocol + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result } - if createLoadBalancerPoolOptions.Members != nil { - body["members"] = createLoadBalancerPoolOptions.Members + + return +} + +// UpdateLoadBalancerListener : Update a load balancer listener +// This request updates a load balancer listener from a listener patch. +func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +} + +// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") + if err != nil { + return } - if createLoadBalancerPoolOptions.Name != nil { - body["name"] = createLoadBalancerPoolOptions.Name + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + if err != nil { + return } - if createLoadBalancerPoolOptions.ProxyProtocol != nil { - body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.ID, } - if createLoadBalancerPoolOptions.SessionPersistence != nil { - body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + if err != nil { + return } - _, err = builder.SetBodyContentJSON(body) + + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) if err != nil { return } @@ -18578,7 +18644,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) if err != nil { return } @@ -18588,45 +18654,45 @@ func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createL return } -// DeleteLoadBalancerPool : Delete a load balancer pool -// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the -// default pool for any listener in the load balancer. -func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener +// This request lists all policies for a load balancer listener. +func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) } -// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") +// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, - "id": *deleteLoadBalancerPoolOptions.ID, + "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -18636,54 +18702,87 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteL return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetLoadBalancerPool : Retrieve a load balancer pool -// This request retrieves a single pool specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener +// Creates a new policy for a load balancer listener. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) } -// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") +// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, - "id": *getLoadBalancerPoolOptions.ID, + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyOptions.Action != nil { + body["action"] = createLoadBalancerListenerPolicyOptions.Action + } + if createLoadBalancerListenerPolicyOptions.Priority != nil { + body["priority"] = createLoadBalancerListenerPolicyOptions.Priority + } + if createLoadBalancerListenerPolicyOptions.Name != nil { + body["name"] = createLoadBalancerListenerPolicyOptions.Name + } + if createLoadBalancerListenerPolicyOptions.Rules != nil { + body["rules"] = createLoadBalancerListenerPolicyOptions.Rules + } + if createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -18695,7 +18794,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -18705,55 +18804,103 @@ func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBal return } -// UpdateLoadBalancerPool : Update a load balancer pool -// This request updates a load balancer pool from a pool patch. -func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy +// Deletes a policy of the load balancer listener. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) } -// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") +// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, - "id": *updateLoadBalancerPoolOptions.ID, + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy +// Retrieve a single policy specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +} + +// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { return } + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + request, err := builder.Build() if err != nil { return @@ -18765,7 +18912,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -18775,49 +18922,56 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateL return } -// ListLoadBalancerPoolMembers : List all members of a load balancer pool -// This request lists all members of a load balancer pool. -func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy +// Updates a policy from a policy patch. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) } -// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter -func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") +// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -18829,7 +18983,7 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) if err != nil { return } @@ -18839,65 +18993,50 @@ func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, li return } -// CreateLoadBalancerPoolMember : Create a member in a load balancer pool -// This request creates a new member and adds the member to the pool. -func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy +// This request lists all rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) } -// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") +// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createLoadBalancerPoolMemberOptions.Port != nil { - body["port"] = createLoadBalancerPoolMemberOptions.Port - } - if createLoadBalancerPoolMemberOptions.Target != nil { - body["target"] = createLoadBalancerPoolMemberOptions.Target - } - if createLoadBalancerPoolMemberOptions.Weight != nil { - body["weight"] = createLoadBalancerPoolMemberOptions.Weight - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return @@ -18909,7 +19048,7 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) if err != nil { return } @@ -18919,42 +19058,42 @@ func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, c return } -// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members -// This request replaces the existing members of the load balancer pool with new members created from the collection of -// member prototype objects. -func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy +// Creates a new rule for the load balancer listener policy. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) } -// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter -func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") +// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, - "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -18965,8 +19104,17 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) - if replaceLoadBalancerPoolMembersOptions.Members != nil { - body["members"] = replaceLoadBalancerPoolMembersOptions.Members + if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { + body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition + } + if createLoadBalancerListenerPolicyRuleOptions.Type != nil { + body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type + } + if createLoadBalancerListenerPolicyRuleOptions.Value != nil { + body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value + } + if createLoadBalancerListenerPolicyRuleOptions.Field != nil { + body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -18984,7 +19132,7 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { return } @@ -18994,42 +19142,43 @@ func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, return } -// DeleteLoadBalancerPoolMember : Delete a load balancer pool member -// This request deletes a member from the pool. This operation cannot be reversed. -func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule +// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) } -// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") +// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, - "id": *deleteLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19047,42 +19196,43 @@ func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, d return } -// GetLoadBalancerPoolMember : Retrieve a load balancer pool member -// This request retrieves a single member specified by the identifier in the URL path. -func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule +// Retrieves a single rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) } -// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") +// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, - "id": *getLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerListenerPolicyRuleOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19102,7 +19252,7 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { return } @@ -19112,42 +19262,43 @@ func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getL return } -// UpdateLoadBalancerPoolMember : Update a load balancer pool member -// This request updates an existing member from a member patch. -func (vpc *VpcV1) UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) +// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule +// Updates a rule of the load balancer listener policy. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) } -// UpdateLoadBalancerPoolMemberWithContext is an alternate form of the UpdateLoadBalancerPoolMember method which supports a Context parameter -func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions cannot be nil") +// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") if err != nil { return } pathParamsMap := map[string]string{ - "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, - "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, - "id": *updateLoadBalancerPoolMemberOptions.ID, + "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19157,7 +19308,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) if err != nil { return } @@ -19173,7 +19324,7 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) if err != nil { return } @@ -19183,33 +19334,40 @@ func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, u return } -// ListEndpointGateways : List all endpoint gateways -// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to -// a target outside the VPC. -func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +// ListLoadBalancerPools : List all pools of a load balancer +// This request lists all pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) } -// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") +// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") if err != nil { return } - + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19217,18 +19375,6 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listEndpointGatewaysOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) - } - if listEndpointGatewaysOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) - } - if listEndpointGatewaysOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) - } - if listEndpointGatewaysOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) - } request, err := builder.Build() if err != nil { @@ -19241,7 +19387,7 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) if err != nil { return } @@ -19251,37 +19397,40 @@ func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpo return } -// CreateEndpointGateway : Create an endpoint gateway -// This request creates a new endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target -// outside the VPC. -func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) +// CreateLoadBalancerPool : Create a load balancer pool +// This request creates a new pool from a pool prototype object. +func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) } -// CreateEndpointGatewayWithContext is an alternate form of the CreateEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createEndpointGatewayOptions, "createEndpointGatewayOptions cannot be nil") +// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createEndpointGatewayOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19292,23 +19441,26 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) body := make(map[string]interface{}) - if createEndpointGatewayOptions.Target != nil { - body["target"] = createEndpointGatewayOptions.Target + if createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm } - if createEndpointGatewayOptions.VPC != nil { - body["vpc"] = createEndpointGatewayOptions.VPC + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor } - if createEndpointGatewayOptions.Ips != nil { - body["ips"] = createEndpointGatewayOptions.Ips + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol } - if createEndpointGatewayOptions.Name != nil { - body["name"] = createEndpointGatewayOptions.Name + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members } - if createEndpointGatewayOptions.ResourceGroup != nil { - body["resource_group"] = createEndpointGatewayOptions.ResourceGroup + if createLoadBalancerPoolOptions.Name != nil { + body["name"] = createLoadBalancerPoolOptions.Name } - if createEndpointGatewayOptions.SecurityGroups != nil { - body["security_groups"] = createEndpointGatewayOptions.SecurityGroups + if createLoadBalancerPoolOptions.ProxyProtocol != nil { + body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol + } + if createLoadBalancerPoolOptions.SessionPersistence != nil { + body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -19326,7 +19478,7 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { return } @@ -19336,117 +19488,98 @@ func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEn return } -// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway -// This request lists all reserved IPs bound to an endpoint gateway. -func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +// DeleteLoadBalancerPool : Delete a load balancer pool +// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the +// default pool for any listener in the load balancer. +func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) } -// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter -func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") +// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, + "id": *deleteLoadBalancerPoolOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listEndpointGatewayIpsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) - } - if listEndpointGatewayIpsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) - } - if listEndpointGatewayIpsOptions.Sort != nil { - builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) - } request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway -// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has -// `auto_delete` set to `true`, the reserved IP will be deleted. -func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +// GetLoadBalancerPool : Retrieve a load balancer pool +// This request retrieves a single pool specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) } -// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") +// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, - "id": *removeEndpointGatewayIPOptions.ID, + "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) @@ -19456,55 +19589,71 @@ func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, remove return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + } return } -// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway -// This request a retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the -// URL. -func (vpc *VpcV1) GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) +// UpdateLoadBalancerPool : Update a load balancer pool +// This request updates a load balancer pool from a pool patch. +func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) } -// GetEndpointGatewayIPWithContext is an alternate form of the GetEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions cannot be nil") +// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, - "id": *getEndpointGatewayIPOptions.ID, + "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerPoolOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -19516,7 +19665,7 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) if err != nil { return } @@ -19526,44 +19675,41 @@ func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpoi return } -// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway -// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: -// -// - must currently be unbound -// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. -func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +// ListLoadBalancerPoolMembers : List all members of a load balancer pool +// This request lists all members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) } -// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter -func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") +// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, - "id": *addEndpointGatewayIPOptions.ID, + "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, } - builder := core.NewRequestBuilder(core.PUT) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19583,7 +19729,7 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { return } @@ -19593,102 +19739,140 @@ func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpoi return } -// DeleteEndpointGateway : Delete an endpoint gateway -// This request deletes an endpoint gateway. This operation cannot be reversed. -// -// Reserved IPs that were bound to the endpoint gateway will be released if their -// `auto_delete` property is set to true. -func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +// CreateLoadBalancerPoolMember : Create a member in a load balancer pool +// This request creates a new member and adds the member to the pool. +func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) } -// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") +// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *deleteEndpointGatewayOptions.ID, + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createLoadBalancerPoolMemberOptions.Port != nil { + body["port"] = createLoadBalancerPoolMemberOptions.Port + } + if createLoadBalancerPoolMemberOptions.Target != nil { + body["target"] = createLoadBalancerPoolMemberOptions.Target + } + if createLoadBalancerPoolMemberOptions.Weight != nil { + body["weight"] = createLoadBalancerPoolMemberOptions.Weight + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + } return } -// GetEndpointGateway : Retrieve an endpoint gateway -// This request retrieves a single endpoint gateway specified by the identifier in the URL. -func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members +// This request replaces the existing members of the load balancer pool with new members created from the collection of +// member prototype objects. +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) } -// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") +// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *getEndpointGatewayOptions.ID, + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range getEndpointGatewayOptions.Headers { + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if replaceLoadBalancerPoolMembersOptions.Members != nil { + body["members"] = replaceLoadBalancerPoolMembersOptions.Members + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -19700,7 +19884,7 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) if err != nil { return } @@ -19710,102 +19894,95 @@ func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpoint return } -// UpdateEndpointGateway : Update an endpoint gateway -// This request updates an endpoint gateway's name. -func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +// DeleteLoadBalancerPoolMember : Delete a load balancer pool member +// This request deletes a member from the pool. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) } -// UpdateEndpointGatewayWithContext is an alternate form of the UpdateEndpointGateway method which supports a Context parameter -func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateEndpointGatewayOptions, "updateEndpointGatewayOptions cannot be nil") +// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateEndpointGatewayOptions.ID, + "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, + "id": *deleteLoadBalancerPoolMemberOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) - if err != nil { - return - } - request, err := builder.Build() if err != nil { return } - var rawResponse map[string]json.RawMessage - response, err = vpc.Service.Request(request, &rawResponse) - if err != nil { - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) - if err != nil { - return - } - response.Result = result - } + response, err = vpc.Service.Request(request, nil) return } -// ListFlowLogCollectors : List all flow log collectors -// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over one or more -// network interfaces within a VPC, depending on the chosen target. -func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +// GetLoadBalancerPoolMember : Retrieve a load balancer pool member +// This request retrieves a single member specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) } -// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter -func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") +// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") if err != nil { return } + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerPoolMemberOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -19813,33 +19990,6 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - if listFlowLogCollectorsOptions.Start != nil { - builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) - } - if listFlowLogCollectorsOptions.Limit != nil { - builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) - } - if listFlowLogCollectorsOptions.ResourceGroupID != nil { - builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) - } - if listFlowLogCollectorsOptions.Name != nil { - builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) - } - if listFlowLogCollectorsOptions.VPCID != nil { - builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) - } - if listFlowLogCollectorsOptions.VPCCRN != nil { - builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) - } - if listFlowLogCollectorsOptions.VPCName != nil { - builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) - } - if listFlowLogCollectorsOptions.TargetID != nil { - builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) - } - if listFlowLogCollectorsOptions.TargetResourceType != nil { - builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) - } request, err := builder.Build() if err != nil { @@ -19852,7 +20002,7 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { return } @@ -19862,64 +20012,52 @@ func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlow return } -// CreateFlowLogCollector : Create a flow log collector -// This request creates and starts a new flow log collector from a flow log collector prototype object. The prototype -// object is structured in the same way as a retrieved flow log collector, and contains the information necessary to -// create and start the new flow log collector. -func (vpc *VpcV1) CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +// UpdateLoadBalancerPoolMember : Update a load balancer pool member +// This request updates an existing member from a member patch. +func (vpc *VpcV1) UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) } -// CreateFlowLogCollectorWithContext is an alternate form of the CreateFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createFlowLogCollectorOptions, "createFlowLogCollectorOptions cannot be nil") +// UpdateLoadBalancerPoolMemberWithContext is an alternate form of the UpdateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") if err != nil { return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, + "id": *updateLoadBalancerPoolMemberOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - body := make(map[string]interface{}) - if createFlowLogCollectorOptions.StorageBucket != nil { - body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket - } - if createFlowLogCollectorOptions.Target != nil { - body["target"] = createFlowLogCollectorOptions.Target - } - if createFlowLogCollectorOptions.Active != nil { - body["active"] = createFlowLogCollectorOptions.Active - } - if createFlowLogCollectorOptions.Name != nil { - body["name"] = createFlowLogCollectorOptions.Name - } - if createFlowLogCollectorOptions.ResourceGroup != nil { - body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup - } - _, err = builder.SetBodyContentJSON(body) + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) if err != nil { return } @@ -19935,7 +20073,7 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) if err != nil { return } @@ -19945,101 +20083,138 @@ func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createF return } -// DeleteFlowLogCollector : Delete a flow log collector -// This request stops and deletes a flow log collector. This operation cannot be reversed. -// -// Collected flow logs remain available within the flow log collector's Cloud Object Storage bucket. -func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { - return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) +// ListEndpointGateways : List all endpoint gateways +// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to +// a target outside the VPC. +func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) } -// DeleteFlowLogCollectorWithContext is an alternate form of the DeleteFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions cannot be nil") - if err != nil { - return - } - err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") +// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *deleteFlowLogCollectorOptions.ID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { return } - for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listEndpointGatewaysOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) + } + if listEndpointGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) + } + if listEndpointGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) + } + if listEndpointGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) + } request, err := builder.Build() if err != nil { return } - response, err = vpc.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + if err != nil { + return + } + response.Result = result + } return } -// GetFlowLogCollector : Retrieve a flow log collector -// This request retrieves a single flow log collector specified by the identifier in the URL. -func (vpc *VpcV1) GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) +// CreateEndpointGateway : Create an endpoint gateway +// This request creates a new endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target +// outside the VPC. +func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) } -// GetFlowLogCollectorWithContext is an alternate form of the GetFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getFlowLogCollectorOptions, "getFlowLogCollectorOptions cannot be nil") +// CreateEndpointGatewayWithContext is an alternate form of the CreateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createEndpointGatewayOptions, "createEndpointGatewayOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") if err != nil { return } - pathParamsMap := map[string]string{ - "id": *getFlowLogCollectorOptions.ID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) if err != nil { return } - for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + for headerName, headerValue := range createEndpointGatewayOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + body := make(map[string]interface{}) + if createEndpointGatewayOptions.Target != nil { + body["target"] = createEndpointGatewayOptions.Target + } + if createEndpointGatewayOptions.VPC != nil { + body["vpc"] = createEndpointGatewayOptions.VPC + } + if createEndpointGatewayOptions.Ips != nil { + body["ips"] = createEndpointGatewayOptions.Ips + } + if createEndpointGatewayOptions.Name != nil { + body["name"] = createEndpointGatewayOptions.Name + } + if createEndpointGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createEndpointGatewayOptions.ResourceGroup + } + if createEndpointGatewayOptions.SecurityGroups != nil { + body["security_groups"] = createEndpointGatewayOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + request, err := builder.Build() if err != nil { return @@ -20051,7 +20226,7 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) if err != nil { return } @@ -20061,54 +20236,55 @@ func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLog return } -// UpdateFlowLogCollector : Update a flow log collector -// This request updates a flow log collector with the information in a provided flow log collector patch. The flow log -// collector patch object is structured in the same way as a retrieved flow log collector and contains only the -// information to be updated. -func (vpc *VpcV1) UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway +// This request lists all reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) } -// UpdateFlowLogCollectorWithContext is an alternate form of the UpdateFlowLogCollector method which supports a Context parameter -func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions cannot be nil") +// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") if err != nil { return } - err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") if err != nil { return } pathParamsMap := map[string]string{ - "id": *updateFlowLogCollectorOptions.ID, + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = vpc.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) if err != nil { return } - for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") builder.AddQuery("version", fmt.Sprint(*vpc.Version)) builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - - _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) - if err != nil { - return + if listEndpointGatewayIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) + } + if listEndpointGatewayIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) + } + if listEndpointGatewayIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) } request, err := builder.Build() @@ -20122,7 +20298,7 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) if err != nil { return } @@ -20132,1023 +20308,1033 @@ func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateF return } -// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. -type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string +// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway +// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) } -// NewAddBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate AddBareMetalServerNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - return &AddBareMetalServerNetworkInterfaceFloatingIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), +// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + if err != nil { + return } -} -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, + } -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } -// SetID : Allow user to set ID -func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options -} + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// SetHeaders : Allow user to set Headers -func (options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } -// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options. -type AddEndpointGatewayIPOptions struct { - // The endpoint gateway identifier. - EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` + request, err := builder.Build() + if err != nil { + return + } - // Allows users to set headers on API requests - Headers map[string]string -} + response, err = vpc.Service.Request(request, nil) -// NewAddEndpointGatewayIPOptions : Instantiate AddEndpointGatewayIPOptions -func (*VpcV1) NewAddEndpointGatewayIPOptions(endpointGatewayID string, id string) *AddEndpointGatewayIPOptions { - return &AddEndpointGatewayIPOptions{ - EndpointGatewayID: core.StringPtr(endpointGatewayID), - ID: core.StringPtr(id), - } + return } -// SetEndpointGatewayID : Allow user to set EndpointGatewayID -func (_options *AddEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *AddEndpointGatewayIPOptions { - _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) - return _options +// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway +// This request a retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the +// URL. +func (vpc *VpcV1) GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) } -// SetID : Allow user to set ID -func (_options *AddEndpointGatewayIPOptions) SetID(id string) *AddEndpointGatewayIPOptions { - _options.ID = core.StringPtr(id) - return _options -} +// GetEndpointGatewayIPWithContext is an alternate form of the GetEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + if err != nil { + return + } -// SetHeaders : Allow user to set Headers -func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) *AddEndpointGatewayIPOptions { - options.Headers = param - return options -} + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, + "id": *getEndpointGatewayIPOptions.ID, + } -// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. -type AddInstanceNetworkInterfaceFloatingIPOptions struct { - // The instance identifier. - InstanceID *string `json:"instance_id" validate:"required,ne="` + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } - // The network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The floating IP identifier. - ID *string `json:"id" validate:"required,ne="` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // Allows users to set headers on API requests - Headers map[string]string -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// NewAddInstanceNetworkInterfaceFloatingIPOptions : Instantiate AddInstanceNetworkInterfaceFloatingIPOptions -func (*VpcV1) NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *AddInstanceNetworkInterfaceFloatingIPOptions { - return &AddInstanceNetworkInterfaceFloatingIPOptions{ - InstanceID: core.StringPtr(instanceID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), + request, err := builder.Build() + if err != nil { + return } -} -// SetInstanceID : Allow user to set InstanceID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.InstanceID = core.StringPtr(instanceID) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options + return } -// SetID : Allow user to set ID -func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *AddInstanceNetworkInterfaceFloatingIPOptions { - _options.ID = core.StringPtr(id) - return _options +// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway +// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: +// +// - must currently be unbound +// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. +func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) } -// SetHeaders : Allow user to set Headers -func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddInstanceNetworkInterfaceFloatingIPOptions { - options.Headers = param - return options -} +// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + if err != nil { + return + } -// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. -type AddVPNGatewayConnectionLocalCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, + } - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // Allows users to set headers on API requests - Headers map[string]string -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - return &AddVPNGatewayConnectionLocalCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), + request, err := builder.Build() + if err != nil { + return } -} -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + } -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.ID = core.StringPtr(id) - return _options + return } -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options +// DeleteEndpointGateway : Delete an endpoint gateway +// This request deletes an endpoint gateway. This operation cannot be reversed. +// +// Reserved IPs that were bound to the endpoint gateway will be released if their +// `auto_delete` property is set to true. +func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) } -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} +// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + if err != nil { + return + } -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { - options.Headers = param - return options -} + pathParamsMap := map[string]string{ + "id": *deleteEndpointGatewayOptions.ID, + } -// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. -type AddVPNGatewayConnectionPeerCIDROptions struct { - // The VPN gateway identifier. - VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } - // The VPN gateway connection identifier. - ID *string `json:"id" validate:"required,ne="` + for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } - // The address prefix part of the CIDR. - CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } - // The prefix length part of the CIDR. - PrefixLength *string `json:"prefix_length" validate:"required,ne="` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) - // Allows users to set headers on API requests - Headers map[string]string + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return } -// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions -func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - return &AddVPNGatewayConnectionPeerCIDROptions{ - VPNGatewayID: core.StringPtr(vpnGatewayID), - ID: core.StringPtr(id), - CIDRPrefix: core.StringPtr(cidrPrefix), - PrefixLength: core.StringPtr(prefixLength), - } -} - -// SetVPNGatewayID : Allow user to set VPNGatewayID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.VPNGatewayID = core.StringPtr(vpnGatewayID) - return _options -} - -// SetID : Allow user to set ID -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetCIDRPrefix : Allow user to set CIDRPrefix -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.CIDRPrefix = core.StringPtr(cidrPrefix) - return _options -} - -// SetPrefixLength : Allow user to set PrefixLength -func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { - _options.PrefixLength = core.StringPtr(prefixLength) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { - options.Headers = param - return options -} - -// AddressPrefix : AddressPrefix struct -type AddressPrefix struct { - // The CIDR block for this prefix. - CIDR *string `json:"cidr" validate:"required"` - - // The date and time that the prefix was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // Indicates whether subnets exist with addresses from this prefix. - HasSubnets *bool `json:"has_subnets" validate:"required"` - - // The URL for this address prefix. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this address prefix. - ID *string `json:"id" validate:"required"` - - // Indicates whether this is the default prefix for this zone in this VPC. If a default prefix was automatically - // created when the VPC was created, the prefix is automatically named using a hyphenated list of randomly-selected - // words, but may be updated with a user-specified name. - IsDefault *bool `json:"is_default" validate:"required"` - - // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. - Name *string `json:"name" validate:"required"` - - // The zone this address prefix resides in. - Zone *ZoneReference `json:"zone" validate:"required"` +// GetEndpointGateway : Retrieve an endpoint gateway +// This request retrieves a single endpoint gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) } -// UnmarshalAddressPrefix unmarshals an instance of AddressPrefix from the specified map of raw messages. -func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefix) - err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) +// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) - if err != nil { - return + + pathParamsMap := map[string]string{ + "id": *getEndpointGatewayOptions.ID, } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return + + for headerName, headerValue := range getEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + return } -// AddressPrefixCollection : AddressPrefixCollection struct -type AddressPrefixCollection struct { - // Collection of address prefixes. - AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` - - // A link to the first page of resources. - First *AddressPrefixCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *AddressPrefixCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +// UpdateEndpointGateway : Update an endpoint gateway +// This request updates an endpoint gateway's name. +func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) } -// UnmarshalAddressPrefixCollection unmarshals an instance of AddressPrefixCollection from the specified map of raw messages. -func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollection) - err = core.UnmarshalModel(m, "address_prefixes", &obj.AddressPrefixes, UnmarshalAddressPrefix) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) +// UpdateEndpointGatewayWithContext is an alternate form of the UpdateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateEndpointGatewayOptions, "updateEndpointGatewayOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) - if err != nil { - return + + pathParamsMap := map[string]string{ + "id": *updateEndpointGatewayOptions.ID, } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// Retrieve the value to be passed to a request to access the next page of results -func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - return start, nil -} + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") -// AddressPrefixCollectionFirst : A link to the first page of resources. -type AddressPrefixCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// UnmarshalAddressPrefixCollectionFirst unmarshals an instance of AddressPrefixCollectionFirst from the specified map of raw messages. -func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// AddressPrefixCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type AddressPrefixCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} + request, err := builder.Build() + if err != nil { + return + } -// UnmarshalAddressPrefixCollectionNext unmarshals an instance of AddressPrefixCollectionNext from the specified map of raw messages. -func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + } + return } -// AddressPrefixPatch : AddressPrefixPatch struct -type AddressPrefixPatch struct { - // Indicates whether this is the default prefix for this zone in this VPC. Updating to true makes this prefix the - // default prefix for this zone in this VPC, provided the VPC currently has no default address prefix for this zone. - // Updating to false removes the default prefix for this zone in this VPC. - IsDefault *bool `json:"is_default,omitempty"` - - // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. - Name *string `json:"name,omitempty"` +// ListFlowLogCollectors : List all flow log collectors +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over one or more +// network interfaces within a VPC, depending on the chosen target. +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) } -// UnmarshalAddressPrefixPatch unmarshals an instance of AddressPrefixPatch from the specified map of raw messages. -func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(AddressPrefixPatch) - err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) +// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter +func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// AsPatch returns a generic map representation of the AddressPrefixPatch -func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(addressPrefixPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + builder.AddHeader(headerName, headerValue) } - return -} - -// BackupPolicy : BackupPolicy struct -type BackupPolicy struct { - // The date and time that the backup policy was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The CRN for this backup policy. - CRN *string `json:"crn" validate:"required"` - - // The URL for this backup policy. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this backup policy. - ID *string `json:"id" validate:"required"` - - // The date and time that the most recent job for this backup policy completed. - // - // If absent, no job has yet completed for this backup policy. - LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"` - - // The lifecycle state of the backup policy. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - // A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will - // be subject to the backup policy. - // - // The enumerated values for this property will expand in the future. When processing this property, check for and log - // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the - // unexpected property value was encountered. - MatchResourceTypes []string `json:"match_resource_types" validate:"required"` - - // The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will - // be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags" validate:"required"` + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") - // The unique user-defined name for this backup policy. - Name *string `json:"name" validate:"required"` + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listFlowLogCollectorsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) + } + if listFlowLogCollectorsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) + } + if listFlowLogCollectorsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) + } + if listFlowLogCollectorsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) + } + if listFlowLogCollectorsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) + } + if listFlowLogCollectorsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) + } + if listFlowLogCollectorsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) + } + if listFlowLogCollectorsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) + } + if listFlowLogCollectorsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) + } - // The plans for the backup policy. - Plans []BackupPolicyPlanReference `json:"plans" validate:"required"` + request, err := builder.Build() + if err != nil { + return + } - // The resource group for this backup policy. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + return + } + response.Result = result + } - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + return } -// Constants associated with the BackupPolicy.LifecycleState property. -// The lifecycle state of the backup policy. -const ( - BackupPolicyLifecycleStateDeletingConst = "deleting" - BackupPolicyLifecycleStateFailedConst = "failed" - BackupPolicyLifecycleStatePendingConst = "pending" - BackupPolicyLifecycleStateStableConst = "stable" - BackupPolicyLifecycleStateSuspendedConst = "suspended" - BackupPolicyLifecycleStateUpdatingConst = "updating" - BackupPolicyLifecycleStateWaitingConst = "waiting" -) - -// Constants associated with the BackupPolicy.MatchResourceTypes property. -// The resource type. -const ( - BackupPolicyMatchResourceTypesVolumeConst = "volume" -) - -// Constants associated with the BackupPolicy.ResourceType property. -// The resource type. -const ( - BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" -) +// CreateFlowLogCollector : Create a flow log collector +// This request creates and starts a new flow log collector from a flow log collector prototype object. The prototype +// object is structured in the same way as a retrieved flow log collector, and contains the information necessary to +// create and start the new flow log collector. +func (vpc *VpcV1) CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +} -// UnmarshalBackupPolicy unmarshals an instance of BackupPolicy from the specified map of raw messages. -func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicy) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) +// CreateFlowLogCollectorWithContext is an alternate form of the CreateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createFlowLogCollectorOptions, "createFlowLogCollectorOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return + + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) - if err != nil { - return + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) - if err != nil { - return + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createFlowLogCollectorOptions.StorageBucket != nil { + body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket } - err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) - if err != nil { - return + if createFlowLogCollectorOptions.Target != nil { + body["target"] = createFlowLogCollectorOptions.Target } - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) - if err != nil { - return + if createFlowLogCollectorOptions.Active != nil { + body["active"] = createFlowLogCollectorOptions.Active } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return + if createFlowLogCollectorOptions.Name != nil { + body["name"] = createFlowLogCollectorOptions.Name } - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) + if createFlowLogCollectorOptions.ResourceGroup != nil { + body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + return } -// BackupPolicyCollection : BackupPolicyCollection struct -type BackupPolicyCollection struct { - // Collection of backup policies. - BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` - - // A link to the first page of resources. - First *BackupPolicyCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BackupPolicyCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +// DeleteFlowLogCollector : Delete a flow log collector +// This request stops and deletes a flow log collector. This operation cannot be reversed. +// +// Collected flow logs remain available within the flow log collector's Cloud Object Storage bucket. +func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) } -// UnmarshalBackupPolicyCollection unmarshals an instance of BackupPolicyCollection from the specified map of raw messages. -func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollection) - err = core.UnmarshalModel(m, "backup_policies", &obj.BackupPolicies, UnmarshalBackupPolicy) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) +// DeleteFlowLogCollectorWithContext is an alternate form of the DeleteFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) - if err != nil { - return + + pathParamsMap := map[string]string{ + "id": *deleteFlowLogCollectorOptions.ID, } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - return start, nil -} -// BackupPolicyCollectionFirst : A link to the first page of resources. -type BackupPolicyCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// UnmarshalBackupPolicyCollectionFirst unmarshals an instance of BackupPolicyCollectionFirst from the specified map of raw messages. -func UnmarshalBackupPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + request, err := builder.Build() if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// BackupPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BackupPolicyCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} + response, err = vpc.Service.Request(request, nil) -// UnmarshalBackupPolicyCollectionNext unmarshals an instance of BackupPolicyCollectionNext from the specified map of raw messages. -func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPatch : BackupPolicyPatch struct -type BackupPolicyPatch struct { - // The user tags this backup policy applies to (replacing any existing tags). Resources that have both a matching user - // tag and a matching type will be subject to the backup policy. - MatchUserTags []string `json:"match_user_tags,omitempty"` - - // The user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. - Name *string `json:"name,omitempty"` +// GetFlowLogCollector : Retrieve a flow log collector +// This request retrieves a single flow log collector specified by the identifier in the URL. +func (vpc *VpcV1) GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) } -// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPatch) - err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) +// GetFlowLogCollectorWithContext is an alternate form of the GetFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getFlowLogCollectorOptions, "getFlowLogCollectorOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} -// AsPatch returns a generic map representation of the BackupPolicyPatch -func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(backupPolicyPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + pathParamsMap := map[string]string{ + "id": *getFlowLogCollectorOptions.ID, } - return -} - -// BackupPolicyPlan : BackupPolicyPlan struct -type BackupPolicyPlan struct { - // Indicates whether the plan is active. - Active *bool `json:"active" validate:"required"` - - // The user tags to attach to backups (snapshots) created by this plan. - AttachUserTags []string `json:"attach_user_tags" validate:"required"` - - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags" validate:"required"` - - // The date and time that the backup policy plan was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec" validate:"required"` - - DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` - - // The URL for this backup policy plan. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this backup policy plan. - ID *string `json:"id" validate:"required"` - - // The lifecycle state of this backup policy plan. - LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The unique user-defined name for this backup policy plan. - Name *string `json:"name" validate:"required"` + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + if err != nil { + return + } - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } -// Constants associated with the BackupPolicyPlan.LifecycleState property. -// The lifecycle state of this backup policy plan. -const ( - BackupPolicyPlanLifecycleStateDeletingConst = "deleting" - BackupPolicyPlanLifecycleStateFailedConst = "failed" - BackupPolicyPlanLifecycleStatePendingConst = "pending" - BackupPolicyPlanLifecycleStateStableConst = "stable" - BackupPolicyPlanLifecycleStateSuspendedConst = "suspended" - BackupPolicyPlanLifecycleStateUpdatingConst = "updating" - BackupPolicyPlanLifecycleStateWaitingConst = "waiting" -) + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") -// Constants associated with the BackupPolicyPlan.ResourceType property. -// The resource type. -const ( - BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" -) + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) -// UnmarshalBackupPolicyPlan unmarshals an instance of BackupPolicyPlan from the specified map of raw messages. -func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlan) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - return + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + + return +} + +// UpdateFlowLogCollector : Update a flow log collector +// This request updates a flow log collector with the information in a provided flow log collector patch. The flow log +// collector patch object is structured in the same way as a retrieved flow log collector and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +} + +// UpdateFlowLogCollectorWithContext is an alternate form of the UpdateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions cannot be nil") if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") if err != nil { return } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) - if err != nil { - return + + pathParamsMap := map[string]string{ + "id": *updateFlowLogCollectorOptions.ID, } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return + + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) } - err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + + request, err := builder.Build() if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + } + return } -// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct -type BackupPolicyPlanCollection struct { - // Collection of backup policy plans. - Plans []BackupPolicyPlan `json:"plans" validate:"required"` +// AddBareMetalServerNetworkInterfaceFloatingIPOptions : The AddBareMetalServerNetworkInterfaceFloatingIP options. +type AddBareMetalServerNetworkInterfaceFloatingIPOptions struct { + // The bare metal server identifier. + BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` + + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. -func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanCollection) - err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) - if err != nil { - return +// NewAddBareMetalServerNetworkInterfaceFloatingIPOptions : Instantiate AddBareMetalServerNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddBareMetalServerNetworkInterfaceFloatingIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + return &AddBareMetalServerNetworkInterfaceFloatingIPOptions{ + BareMetalServerID: core.StringPtr(bareMetalServerID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct -type BackupPolicyPlanDeletionTrigger struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after" validate:"required"` +// SetBareMetalServerID : Allow user to set BareMetalServerID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetBareMetalServerID(bareMetalServerID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.BareMetalServerID = core.StringPtr(bareMetalServerID) + return _options +} - // The maximum number of recent backups to keep. If absent, there is no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options } -// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTrigger) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetID : Allow user to set ID +func (_options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetID(id string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options } -// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct -type BackupPolicyPlanDeletionTriggerPatch struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *AddBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddBareMetalServerNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} - // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options. +type AddEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `json:"endpoint_gateway_id" validate:"required,ne="` + + // The reserved IP identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string } -// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPatch) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return +// NewAddEndpointGatewayIPOptions : Instantiate AddEndpointGatewayIPOptions +func (*VpcV1) NewAddEndpointGatewayIPOptions(endpointGatewayID string, id string) *AddEndpointGatewayIPOptions { + return &AddEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct -type BackupPolicyPlanDeletionTriggerPrototype struct { - // The maximum number of days to keep each backup after creation. - DeleteAfter *int64 `json:"delete_after,omitempty"` +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (_options *AddEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *AddEndpointGatewayIPOptions { + _options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return _options +} - // The maximum number of recent backups to keep. If unspecified, there will be no maximum. - DeleteOverCount *int64 `json:"delete_over_count,omitempty"` +// SetID : Allow user to set ID +func (_options *AddEndpointGatewayIPOptions) SetID(id string) *AddEndpointGatewayIPOptions { + _options.ID = core.StringPtr(id) + return _options } -// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanDeletionTriggerPrototype) - err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) *AddEndpointGatewayIPOptions { + options.Headers = param + return options } -// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct -type BackupPolicyPlanPatch struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` +// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. +type AddInstanceNetworkInterfaceFloatingIPOptions struct { + // The instance identifier. + InstanceID *string `json:"instance_id" validate:"required,ne="` - // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user - // tags for backups that have already been created by this plan. - AttachUserTags []string `json:"attach_user_tags,omitempty"` + // The network interface identifier. + NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` + // The floating IP identifier. + ID *string `json:"id" validate:"required,ne="` - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string +} - DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` +// NewAddInstanceNetworkInterfaceFloatingIPOptions : Instantiate AddInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + return &AddInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} - // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides - // in. - Name *string `json:"name,omitempty"` +// SetInstanceID : Allow user to set InstanceID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.InstanceID = core.StringPtr(instanceID) + return _options } -// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. -func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanPatch) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return _options } -// AsPatch returns a generic map representation of the BackupPolicyPlanPatch -func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(backupPolicyPlanPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return +// SetID : Allow user to set ID +func (_options *AddInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + _options.ID = core.StringPtr(id) + return _options } -// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct -type BackupPolicyPlanPrototype struct { - // Indicates whether the plan is active. - Active *bool `json:"active,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} - // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. - AttachUserTags []string `json:"attach_user_tags,omitempty"` +// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. +type AddVPNGatewayConnectionLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` - // Indicates whether to copy the source's user tags to the created backups (snapshots). - CopyUserTags *bool `json:"copy_user_tags,omitempty"` + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` - // The cron specification for the backup schedule. The backup policy jobs - // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes - // after this time. - // - // All backup schedules for plans in the same policy must be at least an hour apart. - CronSpec *string `json:"cron_spec" validate:"required"` + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` - DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` - // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // Allows users to set headers on API requests + Headers map[string]string } -// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor) -func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) { - _model = &BackupPolicyPlanPrototype{ - CronSpec: core.StringPtr(cronSpec), +// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + return &AddVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), } - err = core.ValidateStruct(_model, "required parameters") - return } -// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages. -func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanPrototype) - err = core.UnmarshalPrimitive(m, "active", &obj.Active) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) - if err != nil { - return +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. +type AddVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `json:"vpn_gateway_id" validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `json:"id" validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `json:"cidr_prefix" validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `json:"prefix_length" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + return &AddVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), } - err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return _options +} + +// SetID : Allow user to set ID +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.CIDRPrefix = core.StringPtr(cidrPrefix) + return _options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (_options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + _options.PrefixLength = core.StringPtr(prefixLength) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// AddressPrefix : AddressPrefix struct +type AddressPrefix struct { + // The CIDR block for this prefix. + CIDR *string `json:"cidr" validate:"required"` + + // The date and time that the prefix was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Indicates whether subnets exist with addresses from this prefix. + HasSubnets *bool `json:"has_subnets" validate:"required"` + + // The URL for this address prefix. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this address prefix. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default prefix for this zone in this VPC. If a default prefix was automatically + // created when the VPC was created, the prefix is automatically named using a hyphenated list of randomly-selected + // words, but may be updated with a user-specified name. + IsDefault *bool `json:"is_default" validate:"required"` + + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + Name *string `json:"name" validate:"required"` + + // The zone this address prefix resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalAddressPrefix unmarshals an instance of AddressPrefix from the specified map of raw messages. +func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefix) + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) if err != nil { return } - err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) + err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) if err != nil { return } @@ -21156,55 +21342,53 @@ func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result int if err != nil { return } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BackupPolicyPlanReference : BackupPolicyPlanReference struct -type BackupPolicyPlanReference struct { - // If present, this property indicates the referenced resource has been deleted and provides - // some supplementary information. - Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` +// AddressPrefixCollection : AddressPrefixCollection struct +type AddressPrefixCollection struct { + // Collection of address prefixes. + AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` - // The URL for this backup policy plan. - Href *string `json:"href" validate:"required"` + // A link to the first page of resources. + First *AddressPrefixCollectionFirst `json:"first" validate:"required"` - // The unique identifier for this backup policy plan. - ID *string `json:"id" validate:"required"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The unique user-defined name for this backup policy plan. - Name *string `json:"name" validate:"required"` + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *AddressPrefixCollectionNext `json:"next,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// Constants associated with the BackupPolicyPlanReference.ResourceType property. -// The resource type. -const ( - BackupPolicyPlanReferenceResourceTypeBackupPolicyPlanConst = "backup_policy_plan" -) - -// UnmarshalBackupPolicyPlanReference unmarshals an instance of BackupPolicyPlanReference from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBackupPolicyPlanReferenceDeleted) +// UnmarshalAddressPrefixCollection unmarshals an instance of AddressPrefixCollection from the specified map of raw messages. +func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollection) + err = core.UnmarshalModel(m, "address_prefixes", &obj.AddressPrefixes, UnmarshalAddressPrefix) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -21212,17 +21396,28 @@ func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result int return } -// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary -// information. -type BackupPolicyPlanReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` +// Retrieve the value to be passed to a request to access the next page of results +func (resp *AddressPrefixCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil } -// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. -func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BackupPolicyPlanReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) +// AddressPrefixCollectionFirst : A link to the first page of resources. +type AddressPrefixCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalAddressPrefixCollectionFirst unmarshals an instance of AddressPrefixCollectionFirst from the specified map of raw messages. +func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -21230,111 +21425,133 @@ func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, res return } -// BareMetalServer : BareMetalServer struct -type BareMetalServer struct { - // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. - Bandwidth *int64 `json:"bandwidth" validate:"required"` +// AddressPrefixCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type AddressPrefixCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} - // The possible resource types for this property are expected to expand in the future. - BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` +// UnmarshalAddressPrefixCollectionNext unmarshals an instance of AddressPrefixCollectionNext from the specified map of raw messages. +func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The bare metal server CPU configuration. - Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` +// AddressPrefixPatch : AddressPrefixPatch struct +type AddressPrefixPatch struct { + // Indicates whether this is the default prefix for this zone in this VPC. Updating to true makes this prefix the + // default prefix for this zone in this VPC, provided the VPC currently has no default address prefix for this zone. + // Updating to false removes the default prefix for this zone in this VPC. + IsDefault *bool `json:"is_default,omitempty"` - // The date and time that the bare metal server was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + Name *string `json:"name,omitempty"` +} - // The CRN for this bare metal server. - CRN *string `json:"crn" validate:"required"` +// UnmarshalAddressPrefixPatch unmarshals an instance of AddressPrefixPatch from the specified map of raw messages. +func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixPatch) + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The disks for this bare metal server, including any disks that are associated with the - // `boot_target`. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` +// AsPatch returns a generic map representation of the AddressPrefixPatch +func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(addressPrefixPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} - // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to - // boot. - EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` +// BackupPolicy : BackupPolicy struct +type BackupPolicy struct { + // The date and time that the backup policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The URL for this bare metal server. + // The CRN for this backup policy. + CRN *string `json:"crn" validate:"required"` + + // The URL for this backup policy. Href *string `json:"href" validate:"required"` - // The unique identifier for this bare metal server. + // The unique identifier for this backup policy. ID *string `json:"id" validate:"required"` - // The amount of memory, truncated to whole gibibytes. - Memory *int64 `json:"memory" validate:"required"` + // The date and time that the most recent job for this backup policy completed. + // + // If absent, no job has yet completed for this backup policy. + LastJobCompletedAt *strfmt.DateTime `json:"last_job_completed_at,omitempty"` - // The user-defined name for this bare metal server (and default system hostname). - Name *string `json:"name" validate:"required"` + // The lifecycle state of the backup policy. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The network interfaces for this bare metal server, including the primary network interface. - NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` + // A resource type this backup policy applies to. Resources that have both a matching type and a matching user tag will + // be subject to the backup policy. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the backup policy on which the + // unexpected property value was encountered. + MatchResourceTypes []string `json:"match_resource_types" validate:"required"` - // Primary network interface. - PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` + // The user tags this backup policy applies to. Resources that have both a matching user tag and a matching type will + // be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags" validate:"required"` - // The profile this bare metal server uses. - Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` + // The unique user-defined name for this backup policy. + Name *string `json:"name" validate:"required"` - // The resource group for this bare metal server. + // The plans for the backup policy. + Plans []BackupPolicyPlanReference `json:"plans" validate:"required"` + + // The resource group for this backup policy. ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - - // The status of the bare metal server. - Status *string `json:"status" validate:"required"` - - // The reasons for the current status (if any). - // - // The enumerated reason code values for this property will expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected reason code was encountered. - StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` - - TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` - - // The VPC this bare metal server resides in. - VPC *VPCReference `json:"vpc" validate:"required"` - - // The zone this bare metal server resides in. - Zone *ZoneReference `json:"zone" validate:"required"` } -// Constants associated with the BareMetalServer.ResourceType property. +// Constants associated with the BackupPolicy.LifecycleState property. +// The lifecycle state of the backup policy. +const ( + BackupPolicyLifecycleStateDeletingConst = "deleting" + BackupPolicyLifecycleStateFailedConst = "failed" + BackupPolicyLifecycleStatePendingConst = "pending" + BackupPolicyLifecycleStateStableConst = "stable" + BackupPolicyLifecycleStateSuspendedConst = "suspended" + BackupPolicyLifecycleStateUpdatingConst = "updating" + BackupPolicyLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the BackupPolicy.MatchResourceTypes property. // The resource type. const ( - BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" + BackupPolicyMatchResourceTypesVolumeConst = "volume" ) -// Constants associated with the BareMetalServer.Status property. -// The status of the bare metal server. +// Constants associated with the BackupPolicy.ResourceType property. +// The resource type. const ( - BareMetalServerStatusFailedConst = "failed" - BareMetalServerStatusMaintenanceConst = "maintenance" - BareMetalServerStatusPendingConst = "pending" - BareMetalServerStatusRestartingConst = "restarting" - BareMetalServerStatusRunningConst = "running" - BareMetalServerStatusStartingConst = "starting" - BareMetalServerStatusStoppedConst = "stopped" - BareMetalServerStatusStoppingConst = "stopping" + BackupPolicyResourceTypeBackupPolicyConst = "backup_policy" ) -// UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. -func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServer) - err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) - if err != nil { - return - } - err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) - if err != nil { - return - } - err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) - if err != nil { - return - } +// UnmarshalBackupPolicy unmarshals an instance of BackupPolicy from the specified map of raw messages. +func UnmarshalBackupPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicy) err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -21343,14 +21560,6 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) - if err != nil { - return - } err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -21359,51 +21568,35 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) if err != nil { return } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + err = core.UnmarshalPrimitive(m, "last_job_completed_at", &obj.LastJobCompletedAt) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "match_resource_types", &obj.MatchResourceTypes) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) if err != nil { return } - err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlanReference) if err != nil { return } - err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -21411,61 +21604,45 @@ func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) return } -// BareMetalServerBootTarget : The possible resource types for this property are expected to expand in the future. -// Models which "extend" this model: -// - BareMetalServerBootTargetBareMetalServerDiskReference -type BareMetalServerBootTarget struct { - // If present, this property indicates the referenced resource has been deleted and provides - // some supplementary information. - Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` - - // The URL for this bare metal server disk. - Href *string `json:"href,omitempty"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id,omitempty"` - - // The user-defined name for this disk. - Name *string `json:"name,omitempty"` +// BackupPolicyCollection : BackupPolicyCollection struct +type BackupPolicyCollection struct { + // Collection of backup policies. + BackupPolicies []BackupPolicy `json:"backup_policies" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` -} + // A link to the first page of resources. + First *BackupPolicyCollectionFirst `json:"first" validate:"required"` -// Constants associated with the BareMetalServerBootTarget.ResourceType property. -// The resource type. -const ( - BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { - return true -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BackupPolicyCollectionNext `json:"next,omitempty"` -type BareMetalServerBootTargetIntf interface { - isaBareMetalServerBootTarget() bool + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. -func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerBootTarget) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) +// UnmarshalBackupPolicyCollection unmarshals an instance of BackupPolicyCollection from the specified map of raw messages. +func UnmarshalBackupPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyCollection) + err = core.UnmarshalModel(m, "backup_policies", &obj.BackupPolicies, UnmarshalBackupPolicy) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBackupPolicyCollectionFirst) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBackupPolicyCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -21473,37 +21650,28 @@ func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result int return } -// BareMetalServerCpu : The bare metal server CPU configuration. -type BareMetalServerCpu struct { - // The CPU architecture. - Architecture *string `json:"architecture" validate:"required"` +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BackupPolicyCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} - // The total number of cores. - CoreCount *int64 `json:"core_count" validate:"required"` +// BackupPolicyCollectionFirst : A link to the first page of resources. +type BackupPolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} - // The total number of CPU sockets. - SocketCount *int64 `json:"socket_count" validate:"required"` - - // The total number of hardware threads per core. - ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"` -} - -// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. -func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCpu) - err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) +// UnmarshalBackupPolicyCollectionFirst unmarshals an instance of BackupPolicyCollectionFirst from the specified map of raw messages. +func UnmarshalBackupPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -21511,45 +21679,16 @@ func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{ return } -// BareMetalServerCollection : BareMetalServerCollection struct -type BareMetalServerCollection struct { - // Collection of bare metal servers. - BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` - - // A link to the first page of resources. - First *BareMetalServerCollectionFirst `json:"first" validate:"required"` - - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` - - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *BareMetalServerCollectionNext `json:"next,omitempty"` - - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` +// BackupPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BackupPolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` } -// UnmarshalBareMetalServerCollection unmarshals an instance of BareMetalServerCollection from the specified map of raw messages. -func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollection) - err = core.UnmarshalModel(m, "bare_metal_servers", &obj.BareMetalServers, UnmarshalBareMetalServer) - if err != nil { - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) - if err != nil { - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) +// UnmarshalBackupPolicyCollectionNext unmarshals an instance of BackupPolicyCollectionNext from the specified map of raw messages. +func UnmarshalBackupPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -21557,28 +21696,24 @@ func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result int return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} +// BackupPolicyPatch : BackupPolicyPatch struct +type BackupPolicyPatch struct { + // The user tags this backup policy applies to (replacing any existing tags). Resources that have both a matching user + // tag and a matching type will be subject to the backup policy. + MatchUserTags []string `json:"match_user_tags,omitempty"` -// BareMetalServerCollectionFirst : A link to the first page of resources. -type BareMetalServerCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` + // The user-defined name for this backup policy. Names must be unique within the region this backup policy resides in. + Name *string `json:"name,omitempty"` } -// UnmarshalBareMetalServerCollectionFirst unmarshals an instance of BareMetalServerCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalBackupPolicyPatch unmarshals an instance of BackupPolicyPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPatch) + err = core.UnmarshalPrimitive(m, "match_user_tags", &obj.MatchUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -21586,132 +21721,97 @@ func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, resul return } -// BareMetalServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalBareMetalServerCollectionNext unmarshals an instance of BareMetalServerCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return +// AsPatch returns a generic map representation of the BackupPolicyPatch +func (backupPolicyPatch *BackupPolicyPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(backupPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerConsoleAccessToken : The bare metal server console access token information. -type BareMetalServerConsoleAccessToken struct { - // A URL safe single-use token used to access the console WebSocket. - AccessToken *string `json:"access_token" validate:"required"` +// BackupPolicyPlan : BackupPolicyPlan struct +type BackupPolicyPlan struct { + // Indicates whether the plan is active. + Active *bool `json:"active" validate:"required"` - // The bare metal server console type for which this token may be used. - ConsoleType *string `json:"console_type" validate:"required"` + // The user tags to attach to backups (snapshots) created by this plan. + AttachUserTags []string `json:"attach_user_tags" validate:"required"` - // The date and time that the access token was created. + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags" validate:"required"` + + // The date and time that the backup policy plan was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The date and time that the access token will expire. - ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` - // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has - // no effect on VNC consoles. - Force *bool `json:"force" validate:"required"` + DeletionTrigger *BackupPolicyPlanDeletionTrigger `json:"deletion_trigger" validate:"required"` - // The URL to access this bare metal server console. + // The URL for this backup policy plan. Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy plan. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of this backup policy plan. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The unique user-defined name for this backup policy plan. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. -// The bare metal server console type for which this token may be used. +// Constants associated with the BackupPolicyPlan.LifecycleState property. +// The lifecycle state of this backup policy plan. const ( - BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" - BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" + BackupPolicyPlanLifecycleStateDeletingConst = "deleting" + BackupPolicyPlanLifecycleStateFailedConst = "failed" + BackupPolicyPlanLifecycleStatePendingConst = "pending" + BackupPolicyPlanLifecycleStateStableConst = "stable" + BackupPolicyPlanLifecycleStateSuspendedConst = "suspended" + BackupPolicyPlanLifecycleStateUpdatingConst = "updating" + BackupPolicyPlanLifecycleStateWaitingConst = "waiting" ) -// UnmarshalBareMetalServerConsoleAccessToken unmarshals an instance of BareMetalServerConsoleAccessToken from the specified map of raw messages. -func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerConsoleAccessToken) - err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) +// Constants associated with the BackupPolicyPlan.ResourceType property. +// The resource type. +const ( + BackupPolicyPlanResourceTypeBackupPolicyPlanConst = "backup_policy_plan" +) + +// UnmarshalBackupPolicyPlan unmarshals an instance of BackupPolicyPlan from the specified map of raw messages. +func UnmarshalBackupPolicyPlan(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlan) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "force", &obj.Force) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerDisk : BareMetalServerDisk struct -type BareMetalServerDisk struct { - // The date and time that the disk was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The URL for this bare metal server disk. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this bare metal server disk. - ID *string `json:"id" validate:"required"` - - // The disk interface used for attaching the disk. - // - // The enumerated values for this property are expected to expand in the future. When processing this property, check - // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the - // unexpected property value was encountered. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The user-defined name for this disk. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` - - // The size of the disk in GB (gigabytes). - Size *int64 `json:"size" validate:"required"` -} - -// Constants associated with the BareMetalServerDisk.InterfaceType property. -// The disk interface used for attaching the disk. -// -// The enumerated values for this property are expected to expand in the future. When processing this property, check -// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the -// unexpected property value was encountered. -const ( - BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" - BareMetalServerDiskInterfaceTypeSataConst = "sata" -) - -// Constants associated with the BareMetalServerDisk.ResourceType property. -// The resource type. -const ( - BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" -) - -// UnmarshalBareMetalServerDisk unmarshals an instance of BareMetalServerDisk from the specified map of raw messages. -func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDisk) - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTrigger) if err != nil { return } @@ -21723,7 +21823,7 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } @@ -21735,24 +21835,20 @@ func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface if err != nil { return } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) - if err != nil { - return - } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct -type BareMetalServerDiskCollection struct { - // Collection of the bare metal server's disks. - Disks []BareMetalServerDisk `json:"disks" validate:"required"` +// BackupPolicyPlanCollection : BackupPolicyPlanCollection struct +type BackupPolicyPlanCollection struct { + // Collection of backup policy plans. + Plans []BackupPolicyPlan `json:"plans" validate:"required"` } -// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages. -func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskCollection) - err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) +// UnmarshalBackupPolicyPlanCollection unmarshals an instance of BackupPolicyPlanCollection from the specified map of raw messages. +func UnmarshalBackupPolicyPlanCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanCollection) + err = core.UnmarshalModel(m, "plans", &obj.Plans, UnmarshalBackupPolicyPlan) if err != nil { return } @@ -21760,16 +21856,23 @@ func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result return } -// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct -type BareMetalServerDiskPatch struct { - // The user-defined name for this disk. - Name *string `json:"name,omitempty"` +// BackupPolicyPlanDeletionTrigger : BackupPolicyPlanDeletionTrigger struct +type BackupPolicyPlanDeletionTrigger struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after" validate:"required"` + + // The maximum number of recent backups to keep. If absent, there is no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` } -// UnmarshalBareMetalServerDiskPatch unmarshals an instance of BareMetalServerDiskPatch from the specified map of raw messages. -func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalBackupPolicyPlanDeletionTrigger unmarshals an instance of BackupPolicyPlanDeletionTrigger from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTrigger(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTrigger) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) if err != nil { return } @@ -21777,27 +21880,23 @@ func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result inte return } -// AsPatch returns a generic map representation of the BareMetalServerDiskPatch -func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerDiskPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} +// BackupPolicyPlanDeletionTriggerPatch : BackupPolicyPlanDeletionTriggerPatch struct +type BackupPolicyPlanDeletionTriggerPatch struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` -// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary -// information. -type BareMetalServerDiskReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` + // The maximum number of recent backups to keep. Specify `null` to remove any existing maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` } -// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. -func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerDiskReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) +// UnmarshalBackupPolicyPlanDeletionTriggerPatch unmarshals an instance of BackupPolicyPlanDeletionTriggerPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPatch) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) if err != nil { return } @@ -21805,31 +21904,23 @@ func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, return } -// BareMetalServerInitialization : BareMetalServerInitialization struct -type BareMetalServerInitialization struct { - // The image the bare metal server was provisioned from. - Image *ImageReference `json:"image" validate:"required"` - - // The public SSH keys used at initialization. - Keys []KeyReference `json:"keys" validate:"required"` +// BackupPolicyPlanDeletionTriggerPrototype : BackupPolicyPlanDeletionTriggerPrototype struct +type BackupPolicyPlanDeletionTriggerPrototype struct { + // The maximum number of days to keep each backup after creation. + DeleteAfter *int64 `json:"delete_after,omitempty"` - // The user accounts that are created at initialization. There can be multiple account types distinguished by the - // `resource_type` property. - UserAccounts []BareMetalServerInitializationUserAccountIntf `json:"user_accounts" validate:"required"` + // The maximum number of recent backups to keep. If unspecified, there will be no maximum. + DeleteOverCount *int64 `json:"delete_over_count,omitempty"` } -// UnmarshalBareMetalServerInitialization unmarshals an instance of BareMetalServerInitialization from the specified map of raw messages. -func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitialization) - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) - if err != nil { - return - } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) +// UnmarshalBackupPolicyPlanDeletionTriggerPrototype unmarshals an instance of BackupPolicyPlanDeletionTriggerPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanDeletionTriggerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanDeletionTriggerPrototype) + err = core.UnmarshalPrimitive(m, "delete_after", &obj.DeleteAfter) if err != nil { return } - err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) + err = core.UnmarshalPrimitive(m, "delete_over_count", &obj.DeleteOverCount) if err != nil { return } @@ -21837,46 +21928,56 @@ func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result return } -// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct -type BareMetalServerInitializationPrototype struct { - // The image to be used when provisioning the bare metal server. - Image ImageIdentityIntf `json:"image" validate:"required"` +// BackupPolicyPlanPatch : BackupPolicyPlanPatch struct +type BackupPolicyPlanPatch struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` - // The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as - // cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the - // administrative user. + // The user tags to attach to backups (snapshots) created by this plan. Updating this value does not change the user + // tags for backups that have already been created by this plan. + AttachUserTags []string `json:"attach_user_tags,omitempty"` + + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` + + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. // - // For Windows images, at least one key must be specified, and one will be chosen to encrypt the administrator - // password. Keys are optional for other images, but if no keys are specified, the instance will be inaccessible unless - // the specified image provides another means of access. - Keys []KeyIdentityIntf `json:"keys" validate:"required"` + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec,omitempty"` - // User data to be made available when initializing the bare metal server. - UserData *string `json:"user_data,omitempty"` -} + DeletionTrigger *BackupPolicyPlanDeletionTriggerPatch `json:"deletion_trigger,omitempty"` -// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor) -func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) { - _model = &BareMetalServerInitializationPrototype{ - Image: image, - Keys: keys, - } - err = core.ValidateStruct(_model, "required parameters") - return + // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides + // in. + Name *string `json:"name,omitempty"` } -// UnmarshalBareMetalServerInitializationPrototype unmarshals an instance of BareMetalServerInitializationPrototype from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationPrototype) - err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) +// UnmarshalBackupPolicyPlanPatch unmarshals an instance of BackupPolicyPlanPatch from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { return } - err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -21884,249 +21985,467 @@ func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessag return } -// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount struct -// Models which "extend" this model: -// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount -type BareMetalServerInitializationUserAccount struct { - // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. - EncryptedPassword *[]byte `json:"encrypted_password,omitempty"` +// AsPatch returns a generic map representation of the BackupPolicyPlanPatch +func (backupPolicyPlanPatch *BackupPolicyPlanPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(backupPolicyPlanPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} - // The public SSH key used to encrypt the password. - EncryptionKey *KeyReference `json:"encryption_key,omitempty"` +// BackupPolicyPlanPrototype : BackupPolicyPlanPrototype struct +type BackupPolicyPlanPrototype struct { + // Indicates whether the plan is active. + Active *bool `json:"active,omitempty"` - // The resource type. - ResourceType *string `json:"resource_type,omitempty"` + // User tags to attach to each backup (snapshot) created by this plan. If unspecified, no user tags will be attached. + AttachUserTags []string `json:"attach_user_tags,omitempty"` - // The username for the account created at initialization. - Username *string `json:"username,omitempty"` -} + // Indicates whether to copy the source's user tags to the created backups (snapshots). + CopyUserTags *bool `json:"copy_user_tags,omitempty"` -// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. -// The resource type. -const ( - BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" -) + // The cron specification for the backup schedule. The backup policy jobs + // (which create and delete backups for this plan) will not start until this time, and may start for up to 90 minutes + // after this time. + // + // All backup schedules for plans in the same policy must be at least an hour apart. + CronSpec *string `json:"cron_spec" validate:"required"` -func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { - return true + DeletionTrigger *BackupPolicyPlanDeletionTriggerPrototype `json:"deletion_trigger,omitempty"` + + // The user-defined name for this backup policy plan. Names must be unique within the backup policy this plan resides + // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` } -type BareMetalServerInitializationUserAccountIntf interface { - isaBareMetalServerInitializationUserAccount() bool +// NewBackupPolicyPlanPrototype : Instantiate BackupPolicyPlanPrototype (Generic Model Constructor) +func (*VpcV1) NewBackupPolicyPlanPrototype(cronSpec string) (_model *BackupPolicyPlanPrototype, err error) { + _model = &BackupPolicyPlanPrototype{ + CronSpec: core.StringPtr(cronSpec), + } + err = core.ValidateStruct(_model, "required parameters") + return } -// UnmarshalBareMetalServerInitializationUserAccount unmarshals an instance of BareMetalServerInitializationUserAccount from the specified map of raw messages. -func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerInitializationUserAccount) - err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) +// UnmarshalBackupPolicyPlanPrototype unmarshals an instance of BackupPolicyPlanPrototype from the specified map of raw messages. +func UnmarshalBackupPolicyPlanPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanPrototype) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) if err != nil { return } - err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + err = core.UnmarshalPrimitive(m, "attach_user_tags", &obj.AttachUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "copy_user_tags", &obj.CopyUserTags) if err != nil { return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) + err = core.UnmarshalPrimitive(m, "cron_spec", &obj.CronSpec) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct -// Models which "extend" this model: -// - BareMetalServerNetworkInterfaceByPci -// - BareMetalServerNetworkInterfaceByVlan -type BareMetalServerNetworkInterface struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + err = core.UnmarshalModel(m, "deletion_trigger", &obj.DeletionTrigger, UnmarshalBackupPolicyPlanDeletionTriggerPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The date and time that the network interface was created. +// BackupPolicyPlanReference : BackupPolicyPlanReference struct +type BackupPolicyPlanReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *BackupPolicyPlanReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this backup policy plan. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this backup policy plan. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this backup policy plan. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the BackupPolicyPlanReference.ResourceType property. +// The resource type. +const ( + BackupPolicyPlanReferenceResourceTypeBackupPolicyPlanConst = "backup_policy_plan" +) + +// UnmarshalBackupPolicyPlanReference unmarshals an instance of BackupPolicyPlanReference from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBackupPolicyPlanReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BackupPolicyPlanReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type BackupPolicyPlanReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBackupPolicyPlanReferenceDeleted unmarshals an instance of BackupPolicyPlanReferenceDeleted from the specified map of raw messages. +func UnmarshalBackupPolicyPlanReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BackupPolicyPlanReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServer : BareMetalServer struct +type BareMetalServer struct { + // The total bandwidth (in megabits per second) shared across the bare metal server's network interfaces. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // The possible resource types for this property are expected to expand in the future. + BootTarget BareMetalServerBootTargetIntf `json:"boot_target" validate:"required"` + + // The bare metal server CPU configuration. + Cpu *BareMetalServerCpu `json:"cpu" validate:"required"` + + // The date and time that the bare metal server was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. - // - // If `false`: - // - Packets are passed unmodified to/from the network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + // The CRN for this bare metal server. + CRN *string `json:"crn" validate:"required"` - // The floating IPs associated with this network interface. - FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + // The disks for this bare metal server, including any disks that are associated with the + // `boot_target`. + Disks []BareMetalServerDisk `json:"disks" validate:"required"` - // The URL for this network interface. + // Indicates whether secure boot is enabled. If enabled, the image must support secure boot or the server will fail to + // boot. + EnableSecureBoot *bool `json:"enable_secure_boot" validate:"required"` + + // The URL for this bare metal server. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this bare metal server. ID *string `json:"id" validate:"required"` - // The network interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1q VLAN tag. - // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its - // array of `allowed_vlans`. - // - Must use an IEEE 802.1q tag. - // - Has its own security groups and does not inherit those of the PCI device through - // which traffic flows. - InterfaceType *string `json:"interface_type" validate:"required"` - - // The MAC address of the interface. If absent, the value is not known. - MacAddress *string `json:"mac_address" validate:"required"` + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` - // The user-defined name for this network interface. + // The user-defined name for this bare metal server (and default system hostname). Name *string `json:"name" validate:"required"` - // The network interface port speed in Mbps. - PortSpeed *int64 `json:"port_speed" validate:"required"` + // The network interfaces for this bare metal server, including the primary network interface. + NetworkInterfaces []NetworkInterfaceBareMetalServerContextReference `json:"network_interfaces" validate:"required"` - PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfaceBareMetalServerContextReference `json:"primary_network_interface" validate:"required"` + + // The profile this bare metal server uses. + Profile *BareMetalServerProfileReference `json:"profile" validate:"required"` + + // The resource group for this bare metal server. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The security groups targeting this network interface. - SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - - // The status of the network interface. + // The status of the bare metal server. Status *string `json:"status" validate:"required"` - // The associated subnet. - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // The type of this bare metal server network interface. - Type *string `json:"type" validate:"required"` + // The reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []BareMetalServerStatusReason `json:"status_reasons" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + TrustedPlatformModule *BareMetalServerTrustedPlatformModule `json:"trusted_platform_module" validate:"required"` - // Indicates if the interface can float to any other server within the same - // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal - // server in the resource group. Applies only to `vlan` type interfaces. - AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + // The VPC this bare metal server resides in. + VPC *VPCReference `json:"vpc" validate:"required"` - // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. - Vlan *int64 `json:"vlan,omitempty"` + // The zone this bare metal server resides in. + Zone *ZoneReference `json:"zone" validate:"required"` } -// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. -// The network interface type: -// - `pci`: a physical PCI device which can only be created or deleted when the bare metal -// server is stopped -// - Has an `allowed_vlans` property which controls the VLANs that will be permitted -// to use the PCI interface -// - Cannot directly use an IEEE 802.1q VLAN tag. -// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its -// array of `allowed_vlans`. -// - Must use an IEEE 802.1q tag. -// - Has its own security groups and does not inherit those of the PCI device through -// which traffic flows. -const ( - BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" -) - -// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. +// Constants associated with the BareMetalServer.ResourceType property. // The resource type. const ( - BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" + BareMetalServerResourceTypeBareMetalServerConst = "bare_metal_server" ) -// Constants associated with the BareMetalServerNetworkInterface.Status property. -// The status of the network interface. +// Constants associated with the BareMetalServer.Status property. +// The status of the bare metal server. const ( - BareMetalServerNetworkInterfaceStatusAvailableConst = "available" - BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" - BareMetalServerNetworkInterfaceStatusFailedConst = "failed" - BareMetalServerNetworkInterfaceStatusPendingConst = "pending" + BareMetalServerStatusFailedConst = "failed" + BareMetalServerStatusMaintenanceConst = "maintenance" + BareMetalServerStatusPendingConst = "pending" + BareMetalServerStatusRestartingConst = "restarting" + BareMetalServerStatusRunningConst = "running" + BareMetalServerStatusStartingConst = "starting" + BareMetalServerStatusStoppedConst = "stopped" + BareMetalServerStatusStoppingConst = "stopping" ) -// Constants associated with the BareMetalServerNetworkInterface.Type property. -// The type of this bare metal server network interface. +// UnmarshalBareMetalServer unmarshals an instance of BareMetalServer from the specified map of raw messages. +func UnmarshalBareMetalServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServer) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_target", &obj.BootTarget, UnmarshalBareMetalServerBootTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cpu", &obj.Cpu, UnmarshalBareMetalServerCpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_secure_boot", &obj.EnableSecureBoot) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceBareMetalServerContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalBareMetalServerProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalBareMetalServerStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "trusted_platform_module", &obj.TrustedPlatformModule, UnmarshalBareMetalServerTrustedPlatformModule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerBootTarget : The possible resource types for this property are expected to expand in the future. +// Models which "extend" this model: +// - BareMetalServerBootTargetBareMetalServerDiskReference +type BareMetalServerBootTarget struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *BareMetalServerDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this bare metal server disk. + Href *string `json:"href,omitempty"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id,omitempty"` + + // The user-defined name for this disk. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the BareMetalServerBootTarget.ResourceType property. +// The resource type. const ( - BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" - BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" + BareMetalServerBootTargetResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" ) -func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { +func (*BareMetalServerBootTarget) isaBareMetalServerBootTarget() bool { return true } -type BareMetalServerNetworkInterfaceIntf interface { - isaBareMetalServerNetworkInterface() bool +type BareMetalServerBootTargetIntf interface { + isaBareMetalServerBootTarget() bool } -// UnmarshalBareMetalServerNetworkInterface unmarshals an instance of BareMetalServerNetworkInterface from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { - // Retrieve discriminator value to determine correct "subclass". - var discValue string - err = core.UnmarshalPrimitive(m, "interface_type", &discValue) +// UnmarshalBareMetalServerBootTarget unmarshals an instance of BareMetalServerBootTarget from the specified map of raw messages. +func UnmarshalBareMetalServerBootTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerBootTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalBareMetalServerDiskReferenceDeleted) if err != nil { - err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) return } - if discValue == "" { - err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { return } - if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) - } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) - } else { - err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct -type BareMetalServerNetworkInterfaceCollection struct { +// BareMetalServerCpu : The bare metal server CPU configuration. +type BareMetalServerCpu struct { + // The CPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The total number of cores. + CoreCount *int64 `json:"core_count" validate:"required"` + + // The total number of CPU sockets. + SocketCount *int64 `json:"socket_count" validate:"required"` + + // The total number of hardware threads per core. + ThreadsPerCore *int64 `json:"threads_per_core" validate:"required"` +} + +// UnmarshalBareMetalServerCpu unmarshals an instance of BareMetalServerCpu from the specified map of raw messages. +func UnmarshalBareMetalServerCpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "core_count", &obj.CoreCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "threads_per_core", &obj.ThreadsPerCore) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerCollection : BareMetalServerCollection struct +type BareMetalServerCollection struct { + // Collection of bare metal servers. + BareMetalServers []BareMetalServer `json:"bare_metal_servers" validate:"required"` + // A link to the first page of resources. - First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + First *BareMetalServerCollectionFirst `json:"first" validate:"required"` // The maximum number of resources that can be returned by the request. Limit *int64 `json:"limit" validate:"required"` - // Collection of network interfaces. - NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` - // A link to the next page of resources. This property is present for all pages // except the last page. - Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` + Next *BareMetalServerCollectionNext `json:"next,omitempty"` // The total number of resources across all pages. TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkInterfaceCollectionFirst) +// UnmarshalBareMetalServerCollection unmarshals an instance of BareMetalServerCollection from the specified map of raw messages. +func UnmarshalBareMetalServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCollection) + err = core.UnmarshalModel(m, "bare_metal_servers", &obj.BareMetalServers, UnmarshalBareMetalServer) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerCollectionFirst) if err != nil { return } - err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerCollectionNext) if err != nil { return } @@ -22139,7 +22458,7 @@ func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMes } // Retrieve the value to be passed to a request to access the next page of results -func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { +func (resp *BareMetalServerCollection) GetNextStart() (*string, error) { if core.IsNil(resp.Next) { return nil, nil } @@ -22150,15 +22469,15 @@ func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, return start, nil } -// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. -type BareMetalServerNetworkInterfaceCollectionFirst struct { +// BareMetalServerCollectionFirst : A link to the first page of resources. +type BareMetalServerCollectionFirst struct { // The URL for a page of resources. Href *string `json:"href" validate:"required"` } -// UnmarshalBareMetalServerNetworkInterfaceCollectionFirst unmarshals an instance of BareMetalServerNetworkInterfaceCollectionFirst from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollectionFirst) +// UnmarshalBareMetalServerCollectionFirst unmarshals an instance of BareMetalServerCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCollectionFirst) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -22167,15 +22486,15 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.R return } -// BareMetalServerNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type BareMetalServerNetworkInterfaceCollectionNext struct { +// BareMetalServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerCollectionNext struct { // The URL for a page of resources. Href *string `json:"href" validate:"required"` } -// UnmarshalBareMetalServerNetworkInterfaceCollectionNext unmarshals an instance of BareMetalServerNetworkInterfaceCollectionNext from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfaceCollectionNext) +// UnmarshalBareMetalServerCollectionNext unmarshals an instance of BareMetalServerCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerCollectionNext) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -22184,44 +22503,127 @@ func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.Ra return } -// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct -type BareMetalServerNetworkInterfacePatch struct { - // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this - // interface. If true, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` +// BareMetalServerConsoleAccessToken : The bare metal server console access token information. +type BareMetalServerConsoleAccessToken struct { + // A URL safe single-use token used to access the console WebSocket. + AccessToken *string `json:"access_token" validate:"required"` - // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be - // in the `allowed_vlans` array for one PCI type adapter per bare metal server. - AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + // The bare metal server console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` - // If `true`: - // - The VPC infrastructure performs any needed NAT operations. - // - A single floating IP can be assigned to the network interface. - // - // If `false`: - // - Packets are passed unmodified to/from the network interface, - // allowing the workload to perform any needed NAT operations. - // - Multiple floating IPs can be assigned to the network interface. - // - `allow_ip_spoofing` must be set to `false`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. - Name *string `json:"name,omitempty"` + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + + // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has + // no effect on VNC consoles. + Force *bool `json:"force" validate:"required"` + + // The URL to access this bare metal server console. + Href *string `json:"href" validate:"required"` } -// UnmarshalBareMetalServerNetworkInterfacePatch unmarshals an instance of BareMetalServerNetworkInterfacePatch from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerNetworkInterfacePatch) - err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) - if err != nil { - return +// Constants associated with the BareMetalServerConsoleAccessToken.ConsoleType property. +// The bare metal server console type for which this token may be used. +const ( + BareMetalServerConsoleAccessTokenConsoleTypeSerialConst = "serial" + BareMetalServerConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// UnmarshalBareMetalServerConsoleAccessToken unmarshals an instance of BareMetalServerConsoleAccessToken from the specified map of raw messages. +func UnmarshalBareMetalServerConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerConsoleAccessToken) + err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) + if err != nil { + return } - err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDisk : BareMetalServerDisk struct +type BareMetalServerDisk struct { + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this bare metal server disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this bare metal server disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The user-defined name for this disk. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the BareMetalServerDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + BareMetalServerDiskInterfaceTypeNvmeConst = "nvme" + BareMetalServerDiskInterfaceTypeSataConst = "sata" +) + +// Constants associated with the BareMetalServerDisk.ResourceType property. +// The resource type. +const ( + BareMetalServerDiskResourceTypeBareMetalServerDiskConst = "bare_metal_server_disk" +) + +// UnmarshalBareMetalServerDisk unmarshals an instance of BareMetalServerDisk from the specified map of raw messages. +func UnmarshalBareMetalServerDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDisk) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) if err != nil { return } @@ -22229,28 +22631,224 @@ func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, if err != nil { return } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch -func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { +// BareMetalServerDiskCollection : BareMetalServerDiskCollection struct +type BareMetalServerDiskCollection struct { + // Collection of the bare metal server's disks. + Disks []BareMetalServerDisk `json:"disks" validate:"required"` +} + +// UnmarshalBareMetalServerDiskCollection unmarshals an instance of BareMetalServerDiskCollection from the specified map of raw messages. +func UnmarshalBareMetalServerDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalBareMetalServerDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerDiskPatch : BareMetalServerDiskPatch struct +type BareMetalServerDiskPatch struct { + // The user-defined name for this disk. + Name *string `json:"name,omitempty"` +} + +// UnmarshalBareMetalServerDiskPatch unmarshals an instance of BareMetalServerDiskPatch from the specified map of raw messages. +func UnmarshalBareMetalServerDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BareMetalServerDiskPatch +func (bareMetalServerDiskPatch *BareMetalServerDiskPatch) AsPatch() (_patch map[string]interface{}, err error) { var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerNetworkInterfacePatch) + jsonData, err = json.Marshal(bareMetalServerDiskPatch) if err == nil { err = json.Unmarshal(jsonData, &_patch) } return } -// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct +// BareMetalServerDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type BareMetalServerDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalBareMetalServerDiskReferenceDeleted unmarshals an instance of BareMetalServerDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalBareMetalServerDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitialization : BareMetalServerInitialization struct +type BareMetalServerInitialization struct { + // The image the bare metal server was provisioned from. + Image *ImageReference `json:"image" validate:"required"` + + // The public SSH keys used at initialization. + Keys []KeyReference `json:"keys" validate:"required"` + + // The user accounts that are created at initialization. There can be multiple account types distinguished by the + // `resource_type` property. + UserAccounts []BareMetalServerInitializationUserAccountIntf `json:"user_accounts" validate:"required"` +} + +// UnmarshalBareMetalServerInitialization unmarshals an instance of BareMetalServerInitialization from the specified map of raw messages. +func UnmarshalBareMetalServerInitialization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitialization) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "user_accounts", &obj.UserAccounts, UnmarshalBareMetalServerInitializationUserAccount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationPrototype : BareMetalServerInitializationPrototype struct +type BareMetalServerInitializationPrototype struct { + // The image to be used when provisioning the bare metal server. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // The public SSH keys to install on the bare metal server. Keys will be made available to the bare metal server as + // cloud-init vendor data. For cloud-init enabled images, these keys will also be added as SSH authorized keys for the + // administrative user. + // + // For Windows images, at least one key must be specified, and one will be chosen to encrypt the administrator + // password. Keys are optional for other images, but if no keys are specified, the instance will be inaccessible unless + // the specified image provides another means of access. + Keys []KeyIdentityIntf `json:"keys" validate:"required"` + + // User data to be made available when initializing the bare metal server. + UserData *string `json:"user_data,omitempty"` +} + +// NewBareMetalServerInitializationPrototype : Instantiate BareMetalServerInitializationPrototype (Generic Model Constructor) +func (*VpcV1) NewBareMetalServerInitializationPrototype(image ImageIdentityIntf, keys []KeyIdentityIntf) (_model *BareMetalServerInitializationPrototype, err error) { + _model = &BareMetalServerInitializationPrototype{ + Image: image, + Keys: keys, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalBareMetalServerInitializationPrototype unmarshals an instance of BareMetalServerInitializationPrototype from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationPrototype) + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerInitializationUserAccount : BareMetalServerInitializationUserAccount struct // Models which "extend" this model: -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype -// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype -type BareMetalServerNetworkInterfacePrototype struct { +// - BareMetalServerInitializationUserAccountBareMetalServerInitializationHostUserAccount +type BareMetalServerInitializationUserAccount struct { + // The password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password,omitempty"` + + // The public SSH key used to encrypt the password. + EncryptionKey *KeyReference `json:"encryption_key,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The username for the account created at initialization. + Username *string `json:"username,omitempty"` +} + +// Constants associated with the BareMetalServerInitializationUserAccount.ResourceType property. +// The resource type. +const ( + BareMetalServerInitializationUserAccountResourceTypeHostUserAccountConst = "host_user_account" +) + +func (*BareMetalServerInitializationUserAccount) isaBareMetalServerInitializationUserAccount() bool { + return true +} + +type BareMetalServerInitializationUserAccountIntf interface { + isaBareMetalServerInitializationUserAccount() bool +} + +// UnmarshalBareMetalServerInitializationUserAccount unmarshals an instance of BareMetalServerInitializationUserAccount from the specified map of raw messages. +func UnmarshalBareMetalServerInitializationUserAccount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerInitializationUserAccount) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterface : BareMetalServerNetworkInterface struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfaceByPci +// - BareMetalServerNetworkInterfaceByVlan +type BareMetalServerNetworkInterface struct { // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this // interface. If true, source IP spoofing is allowed on this interface. - AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` // If `true`: // - The VPC infrastructure performs any needed NAT operations. @@ -22261,7 +22859,16 @@ type BareMetalServerNetworkInterfacePrototype struct { // allowing the workload to perform any needed NAT operations. // - Multiple floating IPs can be assigned to the network interface. // - `allow_ip_spoofing` must be set to `false`. - EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat" validate:"required"` + + // The floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` // The network interface type: // - `pci`: a physical PCI device which can only be created or deleted when the bare metal @@ -22276,23 +22883,31 @@ type BareMetalServerNetworkInterfacePrototype struct { // which traffic flows. InterfaceType *string `json:"interface_type" validate:"required"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. - Name *string `json:"name,omitempty"` + // The MAC address of the interface. If absent, the value is not known. + MacAddress *string `json:"mac_address" validate:"required"` - // The primary IP address to bind to the network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. - // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. - SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + // The network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + PrimaryIP *ReservedIPReference `json:"primary_ip" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The security groups targeting this network interface. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` // The associated subnet. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this bare metal server network interface. + Type *string `json:"type" validate:"required"` // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be // in the `allowed_vlans` array for one PCI type adapter per bare metal server. @@ -22307,7 +22922,7 @@ type BareMetalServerNetworkInterfacePrototype struct { Vlan *int64 `json:"vlan,omitempty"` } -// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. +// Constants associated with the BareMetalServerNetworkInterface.InterfaceType property. // The network interface type: // - `pci`: a physical PCI device which can only be created or deleted when the bare metal // server is stopped @@ -22320,20 +22935,42 @@ type BareMetalServerNetworkInterfacePrototype struct { // - Has its own security groups and does not inherit those of the PCI device through // which traffic flows. const ( - BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" - BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" + BareMetalServerNetworkInterfaceInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfaceInterfaceTypeVlanConst = "vlan" ) -func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { +// Constants associated with the BareMetalServerNetworkInterface.ResourceType property. +// The resource type. +const ( + BareMetalServerNetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the BareMetalServerNetworkInterface.Status property. +// The status of the network interface. +const ( + BareMetalServerNetworkInterfaceStatusAvailableConst = "available" + BareMetalServerNetworkInterfaceStatusDeletingConst = "deleting" + BareMetalServerNetworkInterfaceStatusFailedConst = "failed" + BareMetalServerNetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the BareMetalServerNetworkInterface.Type property. +// The type of this bare metal server network interface. +const ( + BareMetalServerNetworkInterfaceTypePrimaryConst = "primary" + BareMetalServerNetworkInterfaceTypeSecondaryConst = "secondary" +) + +func (*BareMetalServerNetworkInterface) isaBareMetalServerNetworkInterface() bool { return true } -type BareMetalServerNetworkInterfacePrototypeIntf interface { - isaBareMetalServerNetworkInterfacePrototype() bool +type BareMetalServerNetworkInterfaceIntf interface { + isaBareMetalServerNetworkInterface() bool } -// UnmarshalBareMetalServerNetworkInterfacePrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototype from the specified map of raw messages. -func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { +// UnmarshalBareMetalServerNetworkInterface unmarshals an instance of BareMetalServerNetworkInterface from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { // Retrieve discriminator value to determine correct "subclass". var discValue string err = core.UnmarshalPrimitive(m, "interface_type", &discValue) @@ -22346,25 +22983,54 @@ func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMess return } if discValue == "pci" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByPci) } else if discValue == "vlan" { - err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfaceByVlan) } else { err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) } return } -// BareMetalServerPatch : BareMetalServerPatch struct -type BareMetalServerPatch struct { - // The user-defined name for this bare metal server (and default system hostname). - Name *string `json:"name,omitempty"` +// BareMetalServerNetworkInterfaceCollection : BareMetalServerNetworkInterfaceCollection struct +type BareMetalServerNetworkInterfaceCollection struct { + // A link to the first page of resources. + First *BareMetalServerNetworkInterfaceCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network interfaces. + NetworkInterfaces []BareMetalServerNetworkInterfaceIntf `json:"network_interfaces" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *BareMetalServerNetworkInterfaceCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. -func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BareMetalServerPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) +// UnmarshalBareMetalServerNetworkInterfaceCollection unmarshals an instance of BareMetalServerNetworkInterfaceCollection from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalBareMetalServerNetworkInterfaceCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalBareMetalServerNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalBareMetalServerNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -22372,18 +23038,54 @@ func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interfac return } -// AsPatch returns a generic map representation of the BareMetalServerPatch -func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(bareMetalServerPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) +// Retrieve the value to be passed to a request to access the next page of results +func (resp *BareMetalServerNetworkInterfaceCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// BareMetalServerNetworkInterfaceCollectionFirst : A link to the first page of resources. +type BareMetalServerNetworkInterfaceCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceCollectionFirst unmarshals an instance of BareMetalServerNetworkInterfaceCollectionFirst from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct -type BareMetalServerPrimaryNetworkInterfacePrototype struct { +// BareMetalServerNetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type BareMetalServerNetworkInterfaceCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalBareMetalServerNetworkInterfaceCollectionNext unmarshals an instance of BareMetalServerNetworkInterfaceCollectionNext from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfaceCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// BareMetalServerNetworkInterfacePatch : BareMetalServerNetworkInterfacePatch struct +type BareMetalServerNetworkInterfacePatch struct { // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this // interface. If true, source IP spoofing is allowed on this interface. AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` @@ -22403,26 +23105,224 @@ type BareMetalServerPrimaryNetworkInterfacePrototype struct { // - `allow_ip_spoofing` must be set to `false`. EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` - // The network interface type: - // - `pci`: a physical PCI device which can only be created or deleted when the bare metal - // server is stopped - // - Has an `allowed_vlans` property which controls the VLANs that will be permitted - // to use the PCI interface - // - Cannot directly use an IEEE 802.1q VLAN tag. - InterfaceType *string `json:"interface_type,omitempty"` - // The user-defined name for network interface. Names must be unique within the instance the network interface resides - // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + // in. Name *string `json:"name,omitempty"` +} + +// UnmarshalBareMetalServerNetworkInterfacePatch unmarshals an instance of BareMetalServerNetworkInterfacePatch from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerNetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_vlans", &obj.AllowedVlans) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "enable_infrastructure_nat", &obj.EnableInfrastructureNat) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BareMetalServerNetworkInterfacePatch +func (bareMetalServerNetworkInterfacePatch *BareMetalServerNetworkInterfacePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(bareMetalServerNetworkInterfacePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BareMetalServerNetworkInterfacePrototype : BareMetalServerNetworkInterfacePrototype struct +// Models which "extend" this model: +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype +// - BareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype +type BareMetalServerNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The network interface type: + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + // - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its + // array of `allowed_vlans`. + // - Must use an IEEE 802.1q tag. + // - Has its own security groups and does not inherit those of the PCI device through + // which traffic flows. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using + // an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the network interface's subnet. Otherwise, an available address on the + // subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` + + // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // Indicates if the interface can float to any other server within the same + // `resource_group`. The interface will float automatically if the network detects a GARP or RARP on another bare metal + // server in the resource group. Applies only to `vlan` type interfaces. + AllowInterfaceToFloat *bool `json:"allow_interface_to_float,omitempty"` + + // Indicates the 802.1Q VLAN ID tag that must be used for all traffic on this interface. + Vlan *int64 `json:"vlan,omitempty"` +} + +// Constants associated with the BareMetalServerNetworkInterfacePrototype.InterfaceType property. +// The network interface type: +// - `pci`: a physical PCI device which can only be created or deleted when the bare metal +// server is stopped +// - Has an `allowed_vlans` property which controls the VLANs that will be permitted +// to use the PCI interface +// - Cannot directly use an IEEE 802.1q VLAN tag. +// - `vlan`: a virtual device, used through a `pci` device that has the `vlan` in its +// array of `allowed_vlans`. +// - Must use an IEEE 802.1q tag. +// - Has its own security groups and does not inherit those of the PCI device through +// which traffic flows. +const ( + BareMetalServerNetworkInterfacePrototypeInterfaceTypePciConst = "pci" + BareMetalServerNetworkInterfacePrototypeInterfaceTypeVlanConst = "vlan" +) + +func (*BareMetalServerNetworkInterfacePrototype) isaBareMetalServerNetworkInterfacePrototype() bool { + return true +} + +type BareMetalServerNetworkInterfacePrototypeIntf interface { + isaBareMetalServerNetworkInterfacePrototype() bool +} + +// UnmarshalBareMetalServerNetworkInterfacePrototype unmarshals an instance of BareMetalServerNetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalBareMetalServerNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "interface_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'interface_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'interface_type' not found in JSON object") + return + } + if discValue == "pci" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByPciPrototype) + } else if discValue == "vlan" { + err = core.UnmarshalModel(m, "", result, UnmarshalBareMetalServerNetworkInterfacePrototypeBareMetalServerNetworkInterfaceByVlanPrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'interface_type': %s", discValue) + } + return +} + +// BareMetalServerPatch : BareMetalServerPatch struct +type BareMetalServerPatch struct { + // The user-defined name for this bare metal server (and default system hostname). + Name *string `json:"name,omitempty"` +} + +// UnmarshalBareMetalServerPatch unmarshals an instance of BareMetalServerPatch from the specified map of raw messages. +func UnmarshalBareMetalServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BareMetalServerPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the BareMetalServerPatch +func (bareMetalServerPatch *BareMetalServerPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(bareMetalServerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// BareMetalServerPrimaryNetworkInterfacePrototype : BareMetalServerPrimaryNetworkInterfacePrototype struct +type BareMetalServerPrimaryNetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // Indicates what VLAN IDs (for VLAN type only) can use this physical (PCI type) interface. A given VLAN can only be + // in the `allowed_vlans` array for one PCI type adapter per bare metal server. + AllowedVlans []int64 `json:"allowed_vlans,omitempty"` + + // If `true`: + // - The VPC infrastructure performs any needed NAT operations. + // - A single floating IP can be assigned to the network interface. + // + // If `false`: + // - Packets are passed unmodified to/from the network interface, + // allowing the workload to perform any needed NAT operations. + // - Multiple floating IPs can be assigned to the network interface. + // - `allow_ip_spoofing` must be set to `false`. + EnableInfrastructureNat *bool `json:"enable_infrastructure_nat,omitempty"` + + // The network interface type: + // - `pci`: a physical PCI device which can only be created or deleted when the bare metal + // server is stopped + // - Has an `allowed_vlans` property which controls the VLANs that will be permitted + // to use the PCI interface + // - Cannot directly use an IEEE 802.1q VLAN tag. + InterfaceType *string `json:"interface_type,omitempty"` + + // The user-defined name for network interface. Names must be unique within the instance the network interface resides + // in. If unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IP address to bind to the network interface. This can be specified using + // an existing reserved IP, or a prototype object for a new reserved IP. + // + // If an existing reserved IP or a prototype object with an address is specified, it must + // be available on the network interface's subnet. Otherwise, an available address on the + // subnet will be automatically selected and reserved. + PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The primary IP address to bind to the network interface. This can be specified using - // an existing reserved IP, or a prototype object for a new reserved IP. - // - // If an existing reserved IP or a prototype object with an address is specified, it must - // be available on the network interface's subnet. Otherwise, an available address on the - // subnet will be automatically selected and reserved. - PrimaryIP NetworkInterfaceIPPrototypeIntf `json:"primary_ip,omitempty"` - // The security groups to use for this network interface. If unspecified, the VPC's default security group is used. SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` @@ -24691,8 +25591,10 @@ type CreateInstanceGroupOptions struct { // port for the load balancer pool member. ApplicationPort *int64 `json:"application_port,omitempty"` - // The load balancer that the load balancer pool used by this group - // is in. Required when using a load balancer pool. + // The load balancer associated with the specified load balancer pool. + // Required if `load_balancer_pool` is specified. + // + // At present, only load balancers in the `application` family are supported. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` // If specified, the load balancer pool will be managed by this @@ -25677,9 +26579,9 @@ type CreateLoadBalancerPoolMemberOptions struct { Port *int64 `json:"port" validate:"required"` // The pool member target. Load balancers in the `network` family support virtual server - // instances in the same zone as the load balancer's subnet. Load balancers in the - // `application` family support any IP address in the VPC. If the load balancer has - // `route mode` enabled, the member must be in a zone the load balancer has a subnet in. + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` // Weight of the server member. Applicable only if the pool algorithm is @@ -26530,9 +27432,9 @@ type CreateVPCRouteOptions struct { // Names must be unique within the VPC routing table the route resides in. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, it must be omitted or specified as `0.0.0.0`. - NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"` + // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` + // values, it must be omitted or specified as `0.0.0.0`. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // Allows users to set headers on API requests Headers map[string]string @@ -26592,7 +27494,7 @@ func (_options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptio } // SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RouteNextHopPrototypeIntf) *CreateVPCRouteOptions { +func (_options *CreateVPCRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRouteOptions { _options.NextHop = nextHop return _options } @@ -26608,6 +27510,12 @@ type CreateVPCRoutingTableOptions struct { // The VPC identifier. VPCID *string `json:"vpc_id" validate:"required,ne="` + // The filters specifying the resources that may create routes in this routing table. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. If // unspecified, the name will be a hyphenated list of randomly-selected words. Name *string `json:"name,omitempty"` @@ -26666,6 +27574,12 @@ func (_options *CreateVPCRoutingTableOptions) SetVPCID(vpcID string) *CreateVPCR return _options } +// SetAcceptRoutesFrom : Allow user to set AcceptRoutesFrom +func (_options *CreateVPCRoutingTableOptions) SetAcceptRoutesFrom(acceptRoutesFrom []ResourceFilter) *CreateVPCRoutingTableOptions { + _options.AcceptRoutesFrom = acceptRoutesFrom + return _options +} + // SetName : Allow user to set Name func (_options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { _options.Name = core.StringPtr(name) @@ -26731,9 +27645,9 @@ type CreateVPCRoutingTableRouteOptions struct { // Names must be unique within the VPC routing table the route resides in. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, it must be omitted or specified as `0.0.0.0`. - NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"` + // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` + // values, it must be omitted or specified as `0.0.0.0`. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // Allows users to set headers on API requests Headers map[string]string @@ -26800,7 +27714,7 @@ func (_options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateV } // SetNextHop : Allow user to set NextHop -func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RouteNextHopPrototypeIntf) *CreateVPCRoutingTableRouteOptions { +func (_options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RoutePrototypeNextHopIntf) *CreateVPCRoutingTableRouteOptions { _options.NextHop = nextHop return _options } @@ -26877,6 +27791,239 @@ func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *Cre return options } +// CreateVPNServerOptions : The CreateVPNServer options. +type CreateVPNServerOptions struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate" validate:"required"` + + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The subnets to provision this VPN server in. Use subnets in different zones for high availability. + Subnets []SubnetIdentityIntf `json:"subnets" validate:"required"` + + // The DNS server addresses that will be provided to VPN clients connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. Specify `0` to prevent the server + // from disconnecting idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` + + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` + + // The user-defined name for this VPN server. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the VPC this VPN server is serving. + Name *string `json:"name,omitempty"` + + // The port number to use for this VPN server. + Port *int64 `json:"port,omitempty"` + + // The transport protocol to use for this VPN server. + Protocol *string `json:"protocol,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The security groups to use for this VPN server. If unspecified, the VPC's default security group is used. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPNServerOptions.Protocol property. +// The transport protocol to use for this VPN server. +const ( + CreateVPNServerOptionsProtocolTCPConst = "tcp" + CreateVPNServerOptionsProtocolUDPConst = "udp" +) + +// NewCreateVPNServerOptions : Instantiate CreateVPNServerOptions +func (*VpcV1) NewCreateVPNServerOptions(certificate CertificateInstanceIdentityIntf, clientAuthentication []VPNServerAuthenticationPrototypeIntf, clientIPPool string, subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + return &CreateVPNServerOptions{ + Certificate: certificate, + ClientAuthentication: clientAuthentication, + ClientIPPool: core.StringPtr(clientIPPool), + Subnets: subnets, + } +} + +// SetCertificate : Allow user to set Certificate +func (_options *CreateVPNServerOptions) SetCertificate(certificate CertificateInstanceIdentityIntf) *CreateVPNServerOptions { + _options.Certificate = certificate + return _options +} + +// SetClientAuthentication : Allow user to set ClientAuthentication +func (_options *CreateVPNServerOptions) SetClientAuthentication(clientAuthentication []VPNServerAuthenticationPrototypeIntf) *CreateVPNServerOptions { + _options.ClientAuthentication = clientAuthentication + return _options +} + +// SetClientIPPool : Allow user to set ClientIPPool +func (_options *CreateVPNServerOptions) SetClientIPPool(clientIPPool string) *CreateVPNServerOptions { + _options.ClientIPPool = core.StringPtr(clientIPPool) + return _options +} + +// SetSubnets : Allow user to set Subnets +func (_options *CreateVPNServerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateVPNServerOptions { + _options.Subnets = subnets + return _options +} + +// SetClientDnsServerIps : Allow user to set ClientDnsServerIps +func (_options *CreateVPNServerOptions) SetClientDnsServerIps(clientDnsServerIps []IP) *CreateVPNServerOptions { + _options.ClientDnsServerIps = clientDnsServerIps + return _options +} + +// SetClientIdleTimeout : Allow user to set ClientIdleTimeout +func (_options *CreateVPNServerOptions) SetClientIdleTimeout(clientIdleTimeout int64) *CreateVPNServerOptions { + _options.ClientIdleTimeout = core.Int64Ptr(clientIdleTimeout) + return _options +} + +// SetEnableSplitTunneling : Allow user to set EnableSplitTunneling +func (_options *CreateVPNServerOptions) SetEnableSplitTunneling(enableSplitTunneling bool) *CreateVPNServerOptions { + _options.EnableSplitTunneling = core.BoolPtr(enableSplitTunneling) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerOptions) SetName(name string) *CreateVPNServerOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPort : Allow user to set Port +func (_options *CreateVPNServerOptions) SetPort(port int64) *CreateVPNServerOptions { + _options.Port = core.Int64Ptr(port) + return _options +} + +// SetProtocol : Allow user to set Protocol +func (_options *CreateVPNServerOptions) SetProtocol(protocol string) *CreateVPNServerOptions { + _options.Protocol = core.StringPtr(protocol) + return _options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (_options *CreateVPNServerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPNServerOptions { + _options.ResourceGroup = resourceGroup + return _options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (_options *CreateVPNServerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateVPNServerOptions { + _options.SecurityGroups = securityGroups + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerOptions) SetHeaders(param map[string]string) *CreateVPNServerOptions { + options.Headers = param + return options +} + +// CreateVPNServerRouteOptions : The CreateVPNServerRoute options. +type CreateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The destination to use for this VPN route in the VPN server. Must be unique within the VPN server. If an incoming + // packet does not match any destination, it will be dropped. + Destination *string `json:"destination" validate:"required"` + + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver + // the packet to target. + // - `deliver`: deliver the packet to the target. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action,omitempty"` + + // The user-defined name for this VPN route. If unspecified, the name will be a hyphenated list of randomly-selected + // words. Names must be unique within the VPN server the VPN route resides in. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPNServerRouteOptions.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server, then deliver the +// packet to target. +// - `deliver`: deliver the packet to the target. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + CreateVPNServerRouteOptionsActionDeliverConst = "deliver" + CreateVPNServerRouteOptionsActionDropConst = "drop" + CreateVPNServerRouteOptionsActionTranslateConst = "translate" +) + +// NewCreateVPNServerRouteOptions : Instantiate CreateVPNServerRouteOptions +func (*VpcV1) NewCreateVPNServerRouteOptions(vpnServerID string, destination string) *CreateVPNServerRouteOptions { + return &CreateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + Destination: core.StringPtr(destination), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *CreateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *CreateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetDestination : Allow user to set Destination +func (_options *CreateVPNServerRouteOptions) SetDestination(destination string) *CreateVPNServerRouteOptions { + _options.Destination = core.StringPtr(destination) + return _options +} + +// SetAction : Allow user to set Action +func (_options *CreateVPNServerRouteOptions) SetAction(action string) *CreateVPNServerRouteOptions { + _options.Action = core.StringPtr(action) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateVPNServerRouteOptions) SetName(name string) *CreateVPNServerRouteOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNServerRouteOptions) SetHeaders(param map[string]string) *CreateVPNServerRouteOptions { + options.Headers = param + return options +} + // DedicatedHost : DedicatedHost struct type DedicatedHost struct { // The amount of memory in gibibytes that is currently available for instances. @@ -28662,6 +29809,12 @@ func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{} // DefaultRoutingTable : DefaultRoutingTable struct type DefaultRoutingTable struct { + // The filters specifying the resources that may create routes in this routing table. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -28740,6 +29893,10 @@ const ( // UnmarshalDefaultRoutingTable unmarshals an instance of DefaultRoutingTable from the specified map of raw messages. func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(DefaultRoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -30422,6 +31579,9 @@ type DeleteVPCRoutingTableOptions struct { // The routing table identifier. ID *string `json:"id" validate:"required,ne="` + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -30446,6 +31606,12 @@ func (_options *DeleteVPCRoutingTableOptions) SetID(id string) *DeleteVPCRouting return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPCRoutingTableOptions) SetIfMatch(ifMatch string) *DeleteVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *DeleteVPCRoutingTableOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableOptions { options.Headers = param @@ -30566,6 +31732,157 @@ func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *Del return options } +// DeleteVPNServerClientOptions : The DeleteVPNServerClient options. +type DeleteVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerClientOptions : Instantiate DeleteVPNServerClientOptions +func (*VpcV1) NewDeleteVPNServerClientOptions(vpnServerID string, id string) *DeleteVPNServerClientOptions { + return &DeleteVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerClientOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerClientOptions) SetID(id string) *DeleteVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerClientOptions) SetHeaders(param map[string]string) *DeleteVPNServerClientOptions { + options.Headers = param + return options +} + +// DeleteVPNServerOptions : The DeleteVPNServer options. +type DeleteVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerOptions : Instantiate DeleteVPNServerOptions +func (*VpcV1) NewDeleteVPNServerOptions(id string) *DeleteVPNServerOptions { + return &DeleteVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerOptions) SetID(id string) *DeleteVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *DeleteVPNServerOptions) SetIfMatch(ifMatch string) *DeleteVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerOptions) SetHeaders(param map[string]string) *DeleteVPNServerOptions { + options.Headers = param + return options +} + +// DeleteVPNServerRouteOptions : The DeleteVPNServerRoute options. +type DeleteVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNServerRouteOptions : Instantiate DeleteVPNServerRouteOptions +func (*VpcV1) NewDeleteVPNServerRouteOptions(vpnServerID string, id string) *DeleteVPNServerRouteOptions { + return &DeleteVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DeleteVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *DeleteVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DeleteVPNServerRouteOptions) SetID(id string) *DeleteVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNServerRouteOptions) SetHeaders(param map[string]string) *DeleteVPNServerRouteOptions { + options.Headers = param + return options +} + +// DisconnectVPNClientOptions : The DisconnectVPNClient options. +type DisconnectVPNClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDisconnectVPNClientOptions : Instantiate DisconnectVPNClientOptions +func (*VpcV1) NewDisconnectVPNClientOptions(vpnServerID string, id string) *DisconnectVPNClientOptions { + return &DisconnectVPNClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *DisconnectVPNClientOptions) SetVPNServerID(vpnServerID string) *DisconnectVPNClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *DisconnectVPNClientOptions) SetID(id string) *DisconnectVPNClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DisconnectVPNClientOptions) SetHeaders(param map[string]string) *DisconnectVPNClientOptions { + options.Headers = param + return options +} + // EncryptionKeyIdentity : Identifies an encryption key by a unique property. // Models which "extend" this model: // - EncryptionKeyIdentityByCRN @@ -32136,54 +33453,6 @@ func (options *GetBareMetalServerNetworkInterfaceFloatingIPOptions) SetHeaders(p return options } -// GetBareMetalServerNetworkInterfaceIPOptions : The GetBareMetalServerNetworkInterfaceIP options. -type GetBareMetalServerNetworkInterfaceIPOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // The reserved IP identifier. - ID *string `json:"id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewGetBareMetalServerNetworkInterfaceIPOptions : Instantiate GetBareMetalServerNetworkInterfaceIPOptions -func (*VpcV1) NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID string, networkInterfaceID string, id string) *GetBareMetalServerNetworkInterfaceIPOptions { - return &GetBareMetalServerNetworkInterfaceIPOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - ID: core.StringPtr(id), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetBareMetalServerID(bareMetalServerID string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetBareMetalServerNetworkInterfaceIPOptions) SetID(id string) *GetBareMetalServerNetworkInterfaceIPOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *GetBareMetalServerNetworkInterfaceIPOptions) SetHeaders(param map[string]string) *GetBareMetalServerNetworkInterfaceIPOptions { - options.Headers = param - return options -} - // GetBareMetalServerNetworkInterfaceOptions : The GetBareMetalServerNetworkInterface options. type GetBareMetalServerNetworkInterfaceOptions struct { // The bare metal server identifier. @@ -34364,6 +35633,138 @@ func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPN return options } +// GetVPNServerClientConfigurationOptions : The GetVPNServerClientConfiguration options. +type GetVPNServerClientConfigurationOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientConfigurationOptions : Instantiate GetVPNServerClientConfigurationOptions +func (*VpcV1) NewGetVPNServerClientConfigurationOptions(id string) *GetVPNServerClientConfigurationOptions { + return &GetVPNServerClientConfigurationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientConfigurationOptions) SetID(id string) *GetVPNServerClientConfigurationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientConfigurationOptions) SetHeaders(param map[string]string) *GetVPNServerClientConfigurationOptions { + options.Headers = param + return options +} + +// GetVPNServerClientOptions : The GetVPNServerClient options. +type GetVPNServerClientOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN client identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerClientOptions : Instantiate GetVPNServerClientOptions +func (*VpcV1) NewGetVPNServerClientOptions(vpnServerID string, id string) *GetVPNServerClientOptions { + return &GetVPNServerClientOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerClientOptions) SetVPNServerID(vpnServerID string) *GetVPNServerClientOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerClientOptions) SetID(id string) *GetVPNServerClientOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerClientOptions) SetHeaders(param map[string]string) *GetVPNServerClientOptions { + options.Headers = param + return options +} + +// GetVPNServerOptions : The GetVPNServer options. +type GetVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerOptions : Instantiate GetVPNServerOptions +func (*VpcV1) NewGetVPNServerOptions(id string) *GetVPNServerOptions { + return &GetVPNServerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerOptions) SetID(id string) *GetVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerOptions) SetHeaders(param map[string]string) *GetVPNServerOptions { + options.Headers = param + return options +} + +// GetVPNServerRouteOptions : The GetVPNServerRoute options. +type GetVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNServerRouteOptions : Instantiate GetVPNServerRouteOptions +func (*VpcV1) NewGetVPNServerRouteOptions(vpnServerID string, id string) *GetVPNServerRouteOptions { + return &GetVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *GetVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *GetVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetVPNServerRouteOptions) SetID(id string) *GetVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNServerRouteOptions) SetHeaders(param map[string]string) *GetVPNServerRouteOptions { + options.Headers = param + return options +} + // IkePolicy : IkePolicy struct type IkePolicy struct { // The authentication algorithm. @@ -34693,6 +36094,15 @@ type IP struct { Address *string `json:"address" validate:"required"` } +// NewIP : Instantiate IP (Generic Model Constructor) +func (*VpcV1) NewIP(address string) (_model *IP, err error) { + _model = &IP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + // UnmarshalIP unmarshals an instance of IP from the specified map of raw messages. func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IP) @@ -38442,8 +39852,10 @@ type InstanceGroupPatch struct { // `default_trusted_profile.auto_link`. InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` - // The load balancer that the load balancer pool used by this group - // is in. Required when using a load balancer pool. + // The load balancer associated with the specified load balancer pool. + // Required if `load_balancer_pool` is specified. + // + // At present, only load balancers in the `application` family are supported. LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` // If specified, the load balancer pool will be managed by this @@ -41462,44 +42874,6 @@ func (options *ListBareMetalServerNetworkInterfaceFloatingIpsOptions) SetHeaders return options } -// ListBareMetalServerNetworkInterfaceIpsOptions : The ListBareMetalServerNetworkInterfaceIps options. -type ListBareMetalServerNetworkInterfaceIpsOptions struct { - // The bare metal server identifier. - BareMetalServerID *string `json:"bare_metal_server_id" validate:"required,ne="` - - // The network interface identifier. - NetworkInterfaceID *string `json:"network_interface_id" validate:"required,ne="` - - // Allows users to set headers on API requests - Headers map[string]string -} - -// NewListBareMetalServerNetworkInterfaceIpsOptions : Instantiate ListBareMetalServerNetworkInterfaceIpsOptions -func (*VpcV1) NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID string, networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - return &ListBareMetalServerNetworkInterfaceIpsOptions{ - BareMetalServerID: core.StringPtr(bareMetalServerID), - NetworkInterfaceID: core.StringPtr(networkInterfaceID), - } -} - -// SetBareMetalServerID : Allow user to set BareMetalServerID -func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetBareMetalServerID(bareMetalServerID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - _options.BareMetalServerID = core.StringPtr(bareMetalServerID) - return _options -} - -// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID -func (_options *ListBareMetalServerNetworkInterfaceIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListBareMetalServerNetworkInterfaceIpsOptions { - _options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListBareMetalServerNetworkInterfaceIpsOptions) SetHeaders(param map[string]string) *ListBareMetalServerNetworkInterfaceIpsOptions { - options.Headers = param - return options -} - // ListBareMetalServerNetworkInterfacesOptions : The ListBareMetalServerNetworkInterfaces options. type ListBareMetalServerNetworkInterfacesOptions struct { // The bare metal server identifier. @@ -44441,6 +45815,210 @@ func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *List return options } +// ListVPNServerClientsOptions : The ListVPNServerClients options. +type ListVPNServerClientsOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServerClientsOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order. +const ( + ListVPNServerClientsOptionsSortCreatedAtConst = "created_at" +) + +// NewListVPNServerClientsOptions : Instantiate ListVPNServerClientsOptions +func (*VpcV1) NewListVPNServerClientsOptions(vpnServerID string) *ListVPNServerClientsOptions { + return &ListVPNServerClientsOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerClientsOptions) SetVPNServerID(vpnServerID string) *ListVPNServerClientsOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerClientsOptions) SetStart(start string) *ListVPNServerClientsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerClientsOptions) SetLimit(limit int64) *ListVPNServerClientsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerClientsOptions) SetSort(sort string) *ListVPNServerClientsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerClientsOptions) SetHeaders(param map[string]string) *ListVPNServerClientsOptions { + options.Headers = param + return options +} + +// ListVPNServerRoutesOptions : The ListVPNServerRoutes options. +type ListVPNServerRoutesOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServerRoutesOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListVPNServerRoutesOptionsSortCreatedAtConst = "created_at" + ListVPNServerRoutesOptionsSortNameConst = "name" +) + +// NewListVPNServerRoutesOptions : Instantiate ListVPNServerRoutesOptions +func (*VpcV1) NewListVPNServerRoutesOptions(vpnServerID string) *ListVPNServerRoutesOptions { + return &ListVPNServerRoutesOptions{ + VPNServerID: core.StringPtr(vpnServerID), + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *ListVPNServerRoutesOptions) SetVPNServerID(vpnServerID string) *ListVPNServerRoutesOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServerRoutesOptions) SetStart(start string) *ListVPNServerRoutesOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServerRoutesOptions) SetLimit(limit int64) *ListVPNServerRoutesOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServerRoutesOptions) SetSort(sort string) *ListVPNServerRoutesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServerRoutesOptions) SetHeaders(param map[string]string) *ListVPNServerRoutesOptions { + options.Headers = param + return options +} + +// ListVPNServersOptions : The ListVPNServers options. +type ListVPNServersOptions struct { + // Filters the collection to resources with the exact specified name. + Name *string `json:"name,omitempty"` + + // A server-provided token determining what resource to start the page on. + Start *string `json:"start,omitempty"` + + // The number of resources to return on a page. + Limit *int64 `json:"limit,omitempty"` + + // Filters the collection to resources in the resource group with the specified identifier. + ResourceGroupID *string `json:"resource_group.id,omitempty"` + + // Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name + // to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property + // in descending order, and the value `name` sorts it by the `name` property in ascending order. + Sort *string `json:"sort,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNServersOptions.Sort property. +// Sorts the returned collection by the specified property name in ascending order. A `-` may be prepended to the name +// to sort in descending order. For example, the value `-created_at` sorts the collection by the `created_at` property +// in descending order, and the value `name` sorts it by the `name` property in ascending order. +const ( + ListVPNServersOptionsSortCreatedAtConst = "created_at" + ListVPNServersOptionsSortNameConst = "name" +) + +// NewListVPNServersOptions : Instantiate ListVPNServersOptions +func (*VpcV1) NewListVPNServersOptions() *ListVPNServersOptions { + return &ListVPNServersOptions{} +} + +// SetName : Allow user to set Name +func (_options *ListVPNServersOptions) SetName(name string) *ListVPNServersOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListVPNServersOptions) SetStart(start string) *ListVPNServersOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListVPNServersOptions) SetLimit(limit int64) *ListVPNServersOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (_options *ListVPNServersOptions) SetResourceGroupID(resourceGroupID string) *ListVPNServersOptions { + _options.ResourceGroupID = core.StringPtr(resourceGroupID) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListVPNServersOptions) SetSort(sort string) *ListVPNServersOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNServersOptions) SetHeaders(param map[string]string) *ListVPNServersOptions { + options.Headers = param + return options +} + // LoadBalancer : LoadBalancer struct type LoadBalancer struct { // The date and time that this load balancer was created. @@ -46771,9 +48349,9 @@ type LoadBalancerPoolMember struct { ProvisioningStatus *string `json:"provisioning_status" validate:"required"` // The pool member target. Load balancers in the `network` family support virtual server - // instances in the same zone as the load balancer's subnet. Load balancers in the - // `application` family support any IP address in the VPC. If the load balancer has - // `route mode` enabled, the member must be in a zone the load balancer has a subnet in. + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` // Weight of the server member. Applicable only if the pool algorithm is @@ -46869,9 +48447,9 @@ type LoadBalancerPoolMemberPatch struct { Port *int64 `json:"port,omitempty"` // The pool member target. Load balancers in the `network` family support virtual server - // instances in the same zone as the load balancer's subnet. Load balancers in the - // `application` family support any IP address in the VPC. If the load balancer has - // `route mode` enabled, the member must be in a zone the load balancer has a subnet in. + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` // Weight of the server member. Applicable only if the pool algorithm is @@ -46921,9 +48499,9 @@ type LoadBalancerPoolMemberPrototype struct { Port *int64 `json:"port" validate:"required"` // The pool member target. Load balancers in the `network` family support virtual server - // instances in the same zone as the load balancer's subnet. Load balancers in the - // `application` family support any IP address in the VPC. If the load balancer has - // `route mode` enabled, the member must be in a zone the load balancer has a subnet in. + // instances. Load balancers in the `application` family support IP addresses. If the load + // balancer has route mode enabled, the member must be in a zone the load balancer has a + // subnet in. Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` // Weight of the server member. Applicable only if the pool algorithm is @@ -47010,10 +48588,9 @@ func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessag return } -// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances in the same zone as -// the load balancer's subnet. Load balancers in the -// `application` family support any IP address in the VPC. If the load balancer has -// `route mode` enabled, the member must be in a zone the load balancer has a subnet in. +// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. // Models which "extend" this model: // - LoadBalancerPoolMemberTargetInstanceReference // - LoadBalancerPoolMemberTargetIP @@ -47081,10 +48658,9 @@ func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result return } -// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances in the same zone as -// the load balancer's subnet. Load balancers in the -// `application` family support any IP address in the VPC. If the load balancer has -// `route mode` enabled, the member must be in a zone the load balancer has a subnet in. +// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. If the load balancer has route mode enabled, the member must be in a +// zone the load balancer has a subnet in. // Models which "extend" this model: // - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity // - LoadBalancerPoolMemberTargetPrototypeIP @@ -51526,6 +53102,7 @@ func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result in // - ReservedIPTargetNetworkInterfaceReferenceTargetContext // - ReservedIPTargetLoadBalancerReference // - ReservedIPTargetVPNGatewayReference +// - ReservedIPTargetVPNServerReference // - ReservedIPTargetGenericResourceReference type ReservedIPTarget struct { // The CRN for this endpoint gateway. @@ -51635,6 +53212,23 @@ func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result int return } +// ResourceFilter : Identifies one or more resources according to the specified filter property. +type ResourceFilter struct { + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// UnmarshalResourceFilter unmarshals an instance of ResourceFilter from the specified map of raw messages. +func UnmarshalResourceFilter(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceFilter) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. // Models which "extend" this model: @@ -51735,6 +53329,11 @@ type Route struct { // The date and time that the route was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + // If present, the resource that created the route. Routes with this property present cannot be + // directly deleted. All routes with an `origin` of `learned` or `service` will have this + // property set, and future `origin` values may also have this property set. + Creator RouteCreatorIntf `json:"creator,omitempty"` + // The destination of the route. Destination *string `json:"destination" validate:"required"` @@ -51754,6 +53353,15 @@ type Route struct { // other `action` values, its `address` will be `0.0.0.0`. NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + // The origin of this route: + // - `service`: route was directly created by a service + // - `user`: route was directly created by a user + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + Origin *string `json:"origin,omitempty"` + // The zone the route applies to. (Traffic from subnets in this zone will be // subject to this route.). Zone *ZoneReference `json:"zone" validate:"required"` @@ -51785,6 +53393,19 @@ const ( RouteLifecycleStateWaitingConst = "waiting" ) +// Constants associated with the Route.Origin property. +// The origin of this route: +// - `service`: route was directly created by a service +// - `user`: route was directly created by a user +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + RouteOriginServiceConst = "service" + RouteOriginUserConst = "user" +) + // UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(Route) @@ -51796,6 +53417,10 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalModel(m, "creator", &obj.Creator, UnmarshalRouteCreator) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return @@ -51820,6 +53445,10 @@ func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error if err != nil { return } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) if err != nil { return @@ -51920,57 +53549,55 @@ func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface return } -// RouteNextHop : RouteNextHop struct +// RouteCreator : If present, the resource that created the route. Routes with this property present cannot be directly deleted. All +// routes with an `origin` of `learned` or `service` will have this property set, and future `origin` values may also +// have this property set. // Models which "extend" this model: -// - RouteNextHopIP -// - RouteNextHopVPNGatewayConnectionReference -type RouteNextHop struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address,omitempty"` +// - RouteCreatorVPNGatewayReference +// - RouteCreatorVPNServerReference +type RouteCreator struct { + // The VPN gateway's CRN. + CRN *string `json:"crn,omitempty"` // If present, this property indicates the referenced resource has been deleted and provides // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` - // The VPN connection's canonical URL. + // The VPN gateway's canonical URL. Href *string `json:"href,omitempty"` - // The unique identifier for this VPN gateway connection. + // The unique identifier for this VPN gateway. ID *string `json:"id,omitempty"` - // The user-defined name for this VPN connection. + // The user-defined name for this VPN gateway. Name *string `json:"name,omitempty"` // The resource type. ResourceType *string `json:"resource_type,omitempty"` } -// Constants associated with the RouteNextHop.ResourceType property. +// Constants associated with the RouteCreator.ResourceType property. // The resource type. const ( - RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" + RouteCreatorResourceTypeVPNGatewayConst = "vpn_gateway" ) -func (*RouteNextHop) isaRouteNextHop() bool { +func (*RouteCreator) isaRouteCreator() bool { return true } -type RouteNextHopIntf interface { - isaRouteNextHop() bool +type RouteCreatorIntf interface { + isaRouteCreator() bool } -// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. -func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHop) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) +// UnmarshalRouteCreator unmarshals an instance of RouteCreator from the specified map of raw messages. +func UnmarshalRouteCreator(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreator) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) if err != nil { return } @@ -51994,11 +53621,11 @@ func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (er return } -// RouteNextHopPrototype : The next hop packets will be routed to. +// RouteNextHop : RouteNextHop struct // Models which "extend" this model: -// - RouteNextHopPrototypeRouteNextHopIP -// - RouteNextHopPrototypeVPNGatewayConnectionIdentity -type RouteNextHopPrototype struct { +// - RouteNextHopIP +// - RouteNextHopVPNGatewayConnectionReference +type RouteNextHop struct { // The IP address. // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify @@ -52006,29 +53633,45 @@ type RouteNextHopPrototype struct { // error, or bypass the resource on which the unexpected IP address format was encountered. Address *string `json:"address,omitempty"` - // The unique identifier for this VPN gateway connection. - ID *string `json:"id,omitempty"` + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` // The VPN connection's canonical URL. Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The user-defined name for this VPN connection. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` } -func (*RouteNextHopPrototype) isaRouteNextHopPrototype() bool { +// Constants associated with the RouteNextHop.ResourceType property. +// The resource type. +const ( + RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHop) isaRouteNextHop() bool { return true } -type RouteNextHopPrototypeIntf interface { - isaRouteNextHopPrototype() bool +type RouteNextHopIntf interface { + isaRouteNextHop() bool } -// UnmarshalRouteNextHopPrototype unmarshals an instance of RouteNextHopPrototype from the specified map of raw messages. -func UnmarshalRouteNextHopPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPrototype) +// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. +func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHop) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) if err != nil { return } @@ -52036,6 +53679,18 @@ func UnmarshalRouteNextHopPrototype(m map[string]json.RawMessage, result interfa if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -52086,9 +53741,9 @@ type RoutePrototype struct { // Names must be unique within the VPC routing table the route resides in. Name *string `json:"name,omitempty"` - // If `action` is `deliver`, the next hop that packets will be delivered to. For - // other `action` values, it must be omitted or specified as `0.0.0.0`. - NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"` + // If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` + // values, it must be omitted or specified as `0.0.0.0`. + NextHop RoutePrototypeNextHopIntf `json:"next_hop,omitempty"` // The zone to apply the route to. (Traffic from subnets in this zone will be // subject to this route.). @@ -52134,7 +53789,7 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( if err != nil { return } - err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPrototype) + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRoutePrototypeNextHop) if err != nil { return } @@ -52146,6 +53801,53 @@ func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) ( return } +// RoutePrototypeNextHop : If `action` is `deliver`, the next hop that packets will be delivered to. For other `action` values, it must be +// omitted or specified as `0.0.0.0`. +// Models which "extend" this model: +// - RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHop struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RoutePrototypeNextHop) isaRoutePrototypeNextHop() bool { + return true +} + +type RoutePrototypeNextHopIntf interface { + isaRoutePrototypeNextHop() bool +} + +// UnmarshalRoutePrototypeNextHop unmarshals an instance of RoutePrototypeNextHop from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // RouteReference : RouteReference struct type RouteReference struct { // If present, this property indicates the referenced resource has been deleted and provides @@ -52205,6 +53907,12 @@ func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interfa // RoutingTable : RoutingTable struct type RoutingTable struct { + // The filters specifying the resources that may create routes in this routing table. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from" validate:"required"` + // The date and time that this routing table was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` @@ -52281,6 +53989,10 @@ const ( // UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutingTable) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return @@ -52462,6 +54174,15 @@ func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interfac // RoutingTablePatch : RoutingTablePatch struct type RoutingTablePatch struct { + // The filters specifying the resources that may create routes in this routing table + // (replacing any existing filters). All routes learned from resources that match a given filter will be removed when + // an existing filter is removed. Therefore, if an empty array is specified, all filters will be removed, resulting in + // all learned routes being removed. + // + // At present, only the `resource_type` filter is permitted, and only the `vpn_server` value is supported, but filter + // support is expected to expand in the future. + AcceptRoutesFrom []ResourceFilter `json:"accept_routes_from,omitempty"` + // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. Name *string `json:"name,omitempty"` @@ -52506,6 +54227,10 @@ type RoutingTablePatch struct { // UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(RoutingTablePatch) + err = core.UnmarshalModel(m, "accept_routes_from", &obj.AcceptRoutesFrom, UnmarshalResourceFilter) + if err != nil { + return + } err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return @@ -53500,6 +55225,7 @@ func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, re // - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext // - SecurityGroupTargetReferenceLoadBalancerReference // - SecurityGroupTargetReferenceEndpointGatewayReference +// - SecurityGroupTargetReferenceVPNServerReference type SecurityGroupTargetReference struct { // If present, this property indicates the referenced resource has been deleted and provides // some supplementary information. @@ -56828,6 +58554,10 @@ type UpdateVPCRoutingTableOptions struct { // The routing table patch. RoutingTablePatch map[string]interface{} `json:"RoutingTable_patch" validate:"required"` + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + // Allows users to set headers on API requests Headers map[string]string } @@ -56859,6 +58589,12 @@ func (_options *UpdateVPCRoutingTableOptions) SetRoutingTablePatch(routingTableP return _options } +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPCRoutingTableOptions) SetIfMatch(ifMatch string) *UpdateVPCRoutingTableOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateVPCRoutingTableOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableOptions { options.Headers = param @@ -57009,6 +58745,102 @@ func (options *UpdateVPNGatewayOptions) SetHeaders(param map[string]string) *Upd return options } +// UpdateVPNServerOptions : The UpdateVPNServer options. +type UpdateVPNServerOptions struct { + // The VPN server identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN server patch. + VPNServerPatch map[string]interface{} `json:"VPNServer_patch" validate:"required"` + + // If present, the request will fail if the specified ETag value does not match the resource's current ETag value. + // Required if the request body includes an array. + IfMatch *string `json:"If-Match,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNServerOptions : Instantiate UpdateVPNServerOptions +func (*VpcV1) NewUpdateVPNServerOptions(id string, vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + return &UpdateVPNServerOptions{ + ID: core.StringPtr(id), + VPNServerPatch: vpnServerPatch, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerOptions) SetID(id string) *UpdateVPNServerOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerPatch : Allow user to set VPNServerPatch +func (_options *UpdateVPNServerOptions) SetVPNServerPatch(vpnServerPatch map[string]interface{}) *UpdateVPNServerOptions { + _options.VPNServerPatch = vpnServerPatch + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateVPNServerOptions) SetIfMatch(ifMatch string) *UpdateVPNServerOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerOptions) SetHeaders(param map[string]string) *UpdateVPNServerOptions { + options.Headers = param + return options +} + +// UpdateVPNServerRouteOptions : The UpdateVPNServerRoute options. +type UpdateVPNServerRouteOptions struct { + // The VPN server identifier. + VPNServerID *string `json:"vpn_server_id" validate:"required,ne="` + + // The VPN route identifier. + ID *string `json:"id" validate:"required,ne="` + + // The VPN route patch. + VPNServerRoutePatch map[string]interface{} `json:"VPNServerRoute_patch" validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNServerRouteOptions : Instantiate UpdateVPNServerRouteOptions +func (*VpcV1) NewUpdateVPNServerRouteOptions(vpnServerID string, id string, vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + return &UpdateVPNServerRouteOptions{ + VPNServerID: core.StringPtr(vpnServerID), + ID: core.StringPtr(id), + VPNServerRoutePatch: vpnServerRoutePatch, + } +} + +// SetVPNServerID : Allow user to set VPNServerID +func (_options *UpdateVPNServerRouteOptions) SetVPNServerID(vpnServerID string) *UpdateVPNServerRouteOptions { + _options.VPNServerID = core.StringPtr(vpnServerID) + return _options +} + +// SetID : Allow user to set ID +func (_options *UpdateVPNServerRouteOptions) SetID(id string) *UpdateVPNServerRouteOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetVPNServerRoutePatch : Allow user to set VPNServerRoutePatch +func (_options *UpdateVPNServerRouteOptions) SetVPNServerRoutePatch(vpnServerRoutePatch map[string]interface{}) *UpdateVPNServerRouteOptions { + _options.VPNServerRoutePatch = vpnServerRoutePatch + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNServerRouteOptions) SetHeaders(param map[string]string) *UpdateVPNServerRouteOptions { + options.Headers = param + return options +} + // Vcpu : The VCPU configuration. type Vcpu struct { // The VCPU architecture. @@ -57132,19 +58964,961 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpccseSourceIP : VpccseSourceIP struct +type VpccseSourceIP struct { + // The cloud service endpoint source IP address for this zone. + IP *IP `json:"ip" validate:"required"` + + // The zone this cloud service endpoint source IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. +func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpccseSourceIP) + err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollection : VPCCollection struct +type VPCCollection struct { + // A link to the first page of resources. + First *VPCCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPCCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPCs. + Vpcs []VPC `json:"vpcs" validate:"required"` +} + +// UnmarshalVPCCollection unmarshals an instance of VPCCollection from the specified map of raw messages. +func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPCCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VPCCollectionFirst : A link to the first page of resources. +type VPCCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPCCollectionFirst unmarshals an instance of VPCCollectionFirst from the specified map of raw messages. +func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPCCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPCCollectionNext unmarshals an instance of VPCCollectionNext from the specified map of raw messages. +func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - VPCIdentityByID +// - VPCIdentityByCRN +// - VPCIdentityByHref +type VPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VPCIdentity) isaVPCIdentity() bool { + return true +} + +type VPCIdentityIntf interface { + isaVPCIdentity() bool +} + +// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. +func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCPatch : VPCPatch struct +type VPCPatch struct { + // The unique user-defined name for this VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. +func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPCPatch +func (vpcPatch *VPCPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpcPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + +// VPCReference : VPCReference struct +type VPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPC. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPCReference.ResourceType property. +// The resource type. +const ( + VPCReferenceResourceTypeVPCConst = "vpc" +) + +// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. +func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VPCReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGateway : VPNGateway struct +// Models which "extend" this model: +// - VPNGatewayRouteMode +// - VPNGatewayPolicyMode +type VPNGateway struct { + // Connections for this VPN gateway. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGateway.ResourceType property. +// The resource type. +const ( + VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGateway.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayStatusAvailableConst = "available" + VPNGatewayStatusDeletingConst = "deleting" + VPNGatewayStatusFailedConst = "failed" + VPNGatewayStatusPendingConst = "pending" +) + +// Constants associated with the VPNGateway.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayModeRouteConst = "route" +) + +func (*VPNGateway) isaVPNGateway() bool { + return true +} + +type VPNGatewayIntf interface { + isaVPNGateway() bool +} + +// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. +func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGateway) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollection : VPNGatewayCollection struct +type VPNGatewayCollection struct { + // A link to the first page of resources. + First *VPNGatewayCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNGatewayCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN gateways. + VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` +} + +// UnmarshalVPNGatewayCollection unmarshals an instance of VPNGatewayCollection from the specified map of raw messages. +func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNGatewayCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil +} + +// VPNGatewayCollectionFirst : A link to the first page of resources. +type VPNGatewayCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayCollectionFirst unmarshals an instance of VPNGatewayCollectionFirst from the specified map of raw messages. +func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNGatewayCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayCollectionNext unmarshals an instance of VPNGatewayCollectionNext from the specified map of raw messages. +func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnection : VPNGatewayConnection struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionPolicyMode +type VPNGatewayConnection struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The IKE policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // The IPsec policy. If absent, [auto-negotiation is + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// Constants associated with the VPNGatewayConnection.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnection.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionModePolicyConst = "policy" + VPNGatewayConnectionModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnection.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnection.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStatusDownConst = "down" + VPNGatewayConnectionStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnection.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { + return true +} + +type VPNGatewayConnectionIntf interface { + isaVPNGatewayConnection() bool +} + +// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. +func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnection) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. +type VPNGatewayConnectionCollection struct { + // Array of VPN gateway connections. + Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionCollection) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpd : The Dead Peer Detection settings. +type VPNGatewayConnectionDpd struct { + // Dead Peer Detection actions. + Action *string `json:"action" validate:"required"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval" validate:"required"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDpd.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdActionClearConst = "clear" + VPNGatewayConnectionDpdActionHoldConst = "hold" + VPNGatewayConnectionDpdActionNoneConst = "none" + VPNGatewayConnectionDpdActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpd) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPatch struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPatchActionClearConst = "clear" + VPNGatewayConnectionDpdPatchActionHoldConst = "hold" + VPNGatewayConnectionDpdPatchActionNoneConst = "none" + VPNGatewayConnectionDpdPatchActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPrototype struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" + VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" + VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" + VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). +// Models which "extend" this model: +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPatch struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPatchIntf interface { + isaVPNGatewayConnectionIkePolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIkePolicyPrototype : The IKE policy to use. If unspecified, [auto-negotiation will be +// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). +// Models which "extend" this model: +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID +// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref +type VPNGatewayConnectionIkePolicyPrototype struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIkePolicyPrototypeIntf interface { + isaVPNGatewayConnectionIkePolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIkePolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in +// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). +// Models which "extend" this model: +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPatch struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPatchIntf interface { + isaVPNGatewayConnectionIPsecPolicyPatch() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionIPsecPolicyPrototype : The IPsec policy to use. If unspecified, [auto-negotiation will be +// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). +// Models which "extend" this model: +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID +// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref +type VPNGatewayConnectionIPsecPolicyPrototype struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { + return true +} + +type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface { + isaVPNGatewayConnectionIPsecPolicyPrototype() bool +} + +// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionIPsecPolicyPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -57152,23 +59926,16 @@ func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) return } -// VpccseSourceIP : VpccseSourceIP struct -type VpccseSourceIP struct { - // The cloud service endpoint source IP address for this zone. - IP *IP `json:"ip" validate:"required"` - - // The zone this cloud service endpoint source IP resides in. - Zone *ZoneReference `json:"zone" validate:"required"` +// VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct +type VPNGatewayConnectionLocalCIDRs struct { + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` } -// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. -func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VpccseSourceIP) - err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) - if err != nil { - return - } - err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) +// UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionLocalCIDRs) + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) if err != nil { return } @@ -57176,74 +59943,83 @@ func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) ( return } -// VPCCollection : VPCCollection struct -type VPCCollection struct { - // A link to the first page of resources. - First *VPCCollectionFirst `json:"first" validate:"required"` +// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct +// Models which "extend" this model: +// - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch +type VPNGatewayConnectionPatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VPCCollectionNext `json:"next,omitempty"` + // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` + // The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in + // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - // Collection of VPCs. - Vpcs []VPC `json:"vpcs" validate:"required"` + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address,omitempty"` + + // The preshared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` } -// UnmarshalVPCCollection unmarshals an instance of VPCCollection from the specified map of raw messages. -func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) +// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPatch) isaVPNGatewayConnectionPatch() bool { + return true +} + +type VPNGatewayConnectionPatchIntf interface { + isaVPNGatewayConnectionPatch() bool +} + +// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { return } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) if err != nil { return } - err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VPCCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return } - return start, nil -} - -// VPCCollectionFirst : A link to the first page of resources. -type VPCCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} - -// UnmarshalVPCCollectionFirst unmarshals an instance of VPCCollectionFirst from the specified map of raw messages. -func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) if err != nil { return } @@ -57251,16 +60027,26 @@ func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{ return } -// VPCCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPCCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// AsPatch returns a generic map representation of the VPNGatewayConnectionPatch +func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayConnectionPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return } -// UnmarshalVPCCollectionNext unmarshals an instance of VPCCollectionNext from the specified map of raw messages. -func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct +type VPNGatewayConnectionPeerCIDRs struct { + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerCIDRs) + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) if err != nil { return } @@ -57268,112 +60054,134 @@ func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{} return } -// VPCIdentity : Identifies a VPC by a unique property. +// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct // Models which "extend" this model: -// - VPCIdentityByID -// - VPCIdentityByCRN -// - VPCIdentityByHref -type VPCIdentity struct { - // The unique identifier for this VPC. - ID *string `json:"id,omitempty"` +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype +type VPNGatewayConnectionPrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` - // The CRN for this VPC. - CRN *string `json:"crn,omitempty"` + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` - // The URL for this VPC. - Href *string `json:"href,omitempty"` + // The IKE policy to use. If unspecified, [auto-negotiation will be + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). + IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + + // The IPsec policy to use. If unspecified, [auto-negotiation will be + // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). + IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // The peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` } -func (*VPCIdentity) isaVPCIdentity() bool { +// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { return true } -type VPCIdentityIntf interface { - isaVPCIdentity() bool +type VPNGatewayConnectionPrototypeIntf interface { + isaVPNGatewayConnectionPrototype() bool } -// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. -func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCIdentity) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) if err != nil { return } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPCPatch : VPCPatch struct -type VPCPatch struct { - // The unique user-defined name for this VPC. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. -func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the VPCPatch -func (vpcPatch *VPCPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpcPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// VPCReference : VPCReference struct -type VPCReference struct { - // The CRN for this VPC. - CRN *string `json:"crn" validate:"required"` - +// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct +type VPNGatewayConnectionReference struct { // If present, this property indicates the referenced resource has been deleted and provides // some supplementary information. - Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - // The URL for this VPC. + // The VPN connection's canonical URL. Href *string `json:"href" validate:"required"` - // The unique identifier for this VPC. + // The unique identifier for this VPN gateway connection. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this VPC. + // The user-defined name for this VPN connection. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the VPCReference.ResourceType property. +// Constants associated with the VPNGatewayConnectionReference.ResourceType property. // The resource type. const ( - VPCReferenceResourceTypeVPCConst = "vpc" + VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" ) -// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. -func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) +// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) if err != nil { return } @@ -57397,16 +60205,16 @@ func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (er return } -// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary // information. -type VPCReferenceDeleted struct { +type VPNGatewayConnectionReferenceDeleted struct { // Link to documentation about deleted resources. MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. -func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPCReferenceDeleted) +// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReferenceDeleted) err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return @@ -57415,112 +60223,82 @@ func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface return } -// VPNGateway : VPNGateway struct -// Models which "extend" this model: -// - VPNGatewayRouteMode -// - VPNGatewayPolicyMode -type VPNGateway struct { - // Connections for this VPN gateway. - Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` - - // The date and time that this VPN gateway was created. - CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` +// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct +type VPNGatewayConnectionStaticRouteModeTunnel struct { + // The IP address of the VPN gateway member in which the tunnel resides. + PublicIP *IP `json:"public_ip" validate:"required"` - // The VPN gateway's canonical URL. - Href *string `json:"href" validate:"required"` + // The status of the VPN Tunnel. + Status *string `json:"status" validate:"required"` +} - // The unique identifier for this VPN gateway. - ID *string `json:"id" validate:"required"` +// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. +// The status of the VPN Tunnel. +const ( + VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" +) - // Collection of VPN gateway members. - Members []VPNGatewayMember `json:"members" validate:"required"` +// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeTunnel) + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // The user-defined name for this VPN gateway. - Name *string `json:"name" validate:"required"` +// VPNGatewayMember : VPNGatewayMember struct +type VPNGatewayMember struct { + // The private IP address assigned to the VPN gateway member. + // + // This property will be present only when the VPN gateway status is `available`. + PrivateIP *IP `json:"private_ip,omitempty"` - // The resource group for this VPN gateway. - ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + // The public IP address assigned to the VPN gateway member. + PublicIP *IP `json:"public_ip" validate:"required"` - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` + // The high availability role assigned to the VPN gateway member. + Role *string `json:"role" validate:"required"` - // The status of the VPN gateway. + // The status of the VPN gateway member. Status *string `json:"status" validate:"required"` - - Subnet *SubnetReference `json:"subnet" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` } -// Constants associated with the VPNGateway.ResourceType property. -// The resource type. -const ( - VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" -) - -// Constants associated with the VPNGateway.Status property. -// The status of the VPN gateway. +// Constants associated with the VPNGatewayMember.Role property. +// The high availability role assigned to the VPN gateway member. const ( - VPNGatewayStatusAvailableConst = "available" - VPNGatewayStatusDeletingConst = "deleting" - VPNGatewayStatusFailedConst = "failed" - VPNGatewayStatusPendingConst = "pending" + VPNGatewayMemberRoleActiveConst = "active" + VPNGatewayMemberRoleStandbyConst = "standby" ) -// Constants associated with the VPNGateway.Mode property. -// Route mode VPN gateway. +// Constants associated with the VPNGatewayMember.Status property. +// The status of the VPN gateway member. const ( - VPNGatewayModeRouteConst = "route" -) - -func (*VPNGateway) isaVPNGateway() bool { - return true -} - -type VPNGatewayIntf interface { - isaVPNGateway() bool -} - -// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. -func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGateway) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + VPNGatewayMemberStatusAvailableConst = "available" + VPNGatewayMemberStatusDeletingConst = "deleting" + VPNGatewayMemberStatusFailedConst = "failed" + VPNGatewayMemberStatusPendingConst = "pending" +) + +// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. +func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMember) + err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalIP) if err != nil { return } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "role", &obj.Role) if err != nil { return } @@ -57528,11 +60306,20 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err if err != nil { return } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPatch : VPNGatewayPatch struct +type VPNGatewayPatch struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. +func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -57540,45 +60327,65 @@ func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err return } -// VPNGatewayCollection : VPNGatewayCollection struct -type VPNGatewayCollection struct { - // A link to the first page of resources. - First *VPNGatewayCollectionFirst `json:"first" validate:"required"` +// AsPatch returns a generic map representation of the VPNGatewayPatch +func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} - // The maximum number of resources that can be returned by the request. - Limit *int64 `json:"limit" validate:"required"` +// VPNGatewayPrototype : VPNGatewayPrototype struct +// Models which "extend" this model: +// - VPNGatewayPrototypeVPNGatewayRouteModePrototype +// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype +type VPNGatewayPrototype struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` - // A link to the next page of resources. This property is present for all pages - // except the last page. - Next *VPNGatewayCollectionNext `json:"next,omitempty"` + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - // The total number of resources across all pages. - TotalCount *int64 `json:"total_count" validate:"required"` + // Identifies a subnet by a unique property. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - // Collection of VPN gateways. - VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` } -// UnmarshalVPNGatewayCollection unmarshals an instance of VPNGatewayCollection from the specified map of raw messages. -func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollection) - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) +// Constants associated with the VPNGatewayPrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeModeRouteConst = "route" +) + +func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { + return true +} + +type VPNGatewayPrototypeIntf interface { + isaVPNGatewayPrototype() bool +} + +// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) if err != nil { return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { return } @@ -57586,28 +60393,17 @@ func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interfac return } -// Retrieve the value to be passed to a request to access the next page of results -func (resp *VPNGatewayCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil || start == nil { - return nil, err - } - return start, nil -} - -// VPNGatewayCollectionFirst : A link to the first page of resources. -type VPNGatewayCollectionFirst struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` +// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VPNGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` } -// UnmarshalVPNGatewayCollectionFirst unmarshals an instance of VPNGatewayCollectionFirst from the specified map of raw messages. -func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollectionFirst) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) +// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) if err != nil { return } @@ -57615,254 +60411,228 @@ func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result int return } -// VPNGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. -type VPNGatewayCollectionNext struct { - // The URL for a page of resources. - Href *string `json:"href" validate:"required"` -} +// VPNServer : VPNServer struct +type VPNServer struct { + // The certificate instance for this VPN server. + Certificate *CertificateInstanceReference `json:"certificate" validate:"required"` -// UnmarshalVPNGatewayCollectionNext unmarshals an instance of VPNGatewayCollectionNext from the specified map of raw messages. -func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayCollectionNext) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // The methods used to authenticate VPN clients to this VPN server. VPN clients must authenticate against all specified + // methods. + ClientAuthentication []VPNServerAuthenticationIntf `json:"client_authentication" validate:"required"` -// VPNGatewayConnection : VPNGatewayConnection struct -// Models which "extend" this model: -// - VPNGatewayConnectionStaticRouteMode -// - VPNGatewayConnectionPolicyMode -type VPNGatewayConnection struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up" validate:"required"` + // Indicates whether disconnected VPN clients will be automatically deleted after + // `client_auto_delete_timeout` hours have passed. At present, this is always `true`, but may be modifiable in the + // future. + ClientAutoDelete *bool `json:"client_auto_delete" validate:"required"` - // The authentication mode. Only `psk` is currently supported. - AuthenticationMode *string `json:"authentication_mode" validate:"required"` + // If `client_auto_delete` is `true`, the hours after which disconnected VPN clients will be automatically deleted. If + // the value is `0`, disconnected VPN clients will be deleted immediately. This value may be modifiable in the future. + ClientAutoDeleteTimeout *int64 `json:"client_auto_delete_timeout" validate:"required"` - // The date and time that this VPN gateway connection was created. + // The DNS server addresses that will be provided to VPN clients that are connected to this VPN server. + ClientDnsServerIps []IP `json:"client_dns_server_ips" validate:"required"` + + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout" validate:"required"` + + // The VPN client IPv4 address pool, expressed in CIDR format. + ClientIPPool *string `json:"client_ip_pool" validate:"required"` + + // The date and time that the VPN server was created. CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` - // The VPN connection's canonical URL. + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling" validate:"required"` + + // The health of this resource. + // - `ok`: No abnormal behavior detected + // - `degraded`: Experiencing compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a + // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also + // have this state. + HealthState *string `json:"health_state" validate:"required"` + + // Fully qualified domain name assigned to this VPN server. + Hostname *string `json:"hostname" validate:"required"` + + // The URL for this VPN server. Href *string `json:"href" validate:"required"` - // The unique identifier for this VPN gateway connection. + // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The IKE policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + // The lifecycle state of the VPN server. + LifecycleState *string `json:"lifecycle_state" validate:"required"` - // The IPsec policy. If absent, [auto-negotiation is - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + // The unique user-defined name for this VPN server. + Name *string `json:"name" validate:"required"` - // The mode of the VPN gateway. - Mode *string `json:"mode" validate:"required"` + // The port number used by this VPN server. + Port *int64 `json:"port" validate:"required"` - // The user-defined name for this VPN gateway connection. - Name *string `json:"name" validate:"required"` + // The reserved IPs bound to this VPN server. + PrivateIps []ReservedIPReference `json:"private_ips" validate:"required"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol" validate:"required"` - // The preshared key. - Psk *string `json:"psk" validate:"required"` + // The resource group for this VPN server. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` - // The status of a VPN gateway connection. - Status *string `json:"status" validate:"required"` - - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` - - // The VPN tunnel configuration for this VPN gateway connection (in static route mode). - Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` + // The security groups targeting this VPN server. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` + // The subnets this VPN server is provisioned in. + Subnets []SubnetReference `json:"subnets" validate:"required"` - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` + // The VPC this VPN server resides in. + VPC *VPCReference `json:"vpc" validate:"required"` } -// Constants associated with the VPNGatewayConnection.AuthenticationMode property. -// The authentication mode. Only `psk` is currently supported. -const ( - VPNGatewayConnectionAuthenticationModePskConst = "psk" -) - -// Constants associated with the VPNGatewayConnection.Mode property. -// The mode of the VPN gateway. +// Constants associated with the VPNServer.HealthState property. +// The health of this resource. +// - `ok`: No abnormal behavior detected +// - `degraded`: Experiencing compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle +// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this +// state. const ( - VPNGatewayConnectionModePolicyConst = "policy" - VPNGatewayConnectionModeRouteConst = "route" + VPNServerHealthStateDegradedConst = "degraded" + VPNServerHealthStateFaultedConst = "faulted" + VPNServerHealthStateInapplicableConst = "inapplicable" + VPNServerHealthStateOkConst = "ok" ) -// Constants associated with the VPNGatewayConnection.ResourceType property. -// The resource type. +// Constants associated with the VPNServer.LifecycleState property. +// The lifecycle state of the VPN server. const ( - VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" + VPNServerLifecycleStateDeletingConst = "deleting" + VPNServerLifecycleStateFailedConst = "failed" + VPNServerLifecycleStatePendingConst = "pending" + VPNServerLifecycleStateStableConst = "stable" + VPNServerLifecycleStateSuspendedConst = "suspended" + VPNServerLifecycleStateUpdatingConst = "updating" + VPNServerLifecycleStateWaitingConst = "waiting" ) -// Constants associated with the VPNGatewayConnection.Status property. -// The status of a VPN gateway connection. +// Constants associated with the VPNServer.Protocol property. +// The transport protocol used by this VPN server. const ( - VPNGatewayConnectionStatusDownConst = "down" - VPNGatewayConnectionStatusUpConst = "up" + VPNServerProtocolTCPConst = "tcp" + VPNServerProtocolUDPConst = "udp" ) -// Constants associated with the VPNGatewayConnection.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// Constants associated with the VPNServer.ResourceType property. +// The resource type. const ( - VPNGatewayConnectionRoutingProtocolNoneConst = "none" + VPNServerResourceTypeVPNServerConst = "vpn_server" ) -func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { - return true -} - -type VPNGatewayConnectionIntf interface { - isaVPNGatewayConnection() bool -} - -// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. -func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnection) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) +// UnmarshalVPNServer unmarshals an instance of VPNServer from the specified map of raw messages. +func UnmarshalVPNServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServer) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthentication) if err != nil { return } - err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + err = core.UnmarshalPrimitive(m, "client_auto_delete", &obj.ClientAutoDelete) if err != nil { return } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + err = core.UnmarshalPrimitive(m, "client_auto_delete_timeout", &obj.ClientAutoDeleteTimeout) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) if err != nil { return } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) if err != nil { return } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) if err != nil { return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) if err != nil { return } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } - err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { return } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalReservedIPReference) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. -type VPNGatewayConnectionCollection struct { - // Array of VPN gateway connections. - Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionCollection) - err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionDpd : The Dead Peer Detection settings. -type VPNGatewayConnectionDpd struct { - // Dead Peer Detection actions. - Action *string `json:"action" validate:"required"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval" validate:"required"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionDpd.Action property. -// Dead Peer Detection actions. -const ( - VPNGatewayConnectionDpdActionClearConst = "clear" - VPNGatewayConnectionDpdActionHoldConst = "hold" - VPNGatewayConnectionDpdActionNoneConst = "none" - VPNGatewayConnectionDpdActionRestartConst = "restart" -) - -// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpd) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) if err != nil { return } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) if err != nil { return } @@ -57870,39 +60640,55 @@ func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result inter return } -// VPNGatewayConnectionDpdPatch : The Dead Peer Detection settings. -type VPNGatewayConnectionDpdPatch struct { - // Dead Peer Detection actions. - Action *string `json:"action,omitempty"` +// VPNServerAuthentication : An authentication method for this VPN server. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsername +// - VPNServerAuthenticationByCertificate +type VPNServerAuthentication struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval,omitempty"` + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout,omitempty"` + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` } -// Constants associated with the VPNGatewayConnectionDpdPatch.Action property. -// Dead Peer Detection actions. +// Constants associated with the VPNServerAuthentication.Method property. +// The type of authentication. const ( - VPNGatewayConnectionDpdPatchActionClearConst = "clear" - VPNGatewayConnectionDpdPatchActionHoldConst = "hold" - VPNGatewayConnectionDpdPatchActionNoneConst = "none" - VPNGatewayConnectionDpdPatchActionRestartConst = "restart" + VPNServerAuthenticationMethodCertificateConst = "certificate" + VPNServerAuthenticationMethodUsernameConst = "username" ) -// UnmarshalVPNGatewayConnectionDpdPatch unmarshals an instance of VPNGatewayConnectionDpdPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpdPatch) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) +func (*VPNServerAuthentication) isaVPNServerAuthentication() bool { + return true +} + +type VPNServerAuthenticationIntf interface { + isaVPNServerAuthentication() bool +} + +// UnmarshalVPNServerAuthentication unmarshals an instance of VPNServerAuthentication from the specified map of raw messages. +func UnmarshalVPNServerAuthentication(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthentication) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) if err != nil { return } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) if err != nil { return } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) if err != nil { return } @@ -57910,39 +60696,42 @@ func UnmarshalVPNGatewayConnectionDpdPatch(m map[string]json.RawMessage, result return } -// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. -type VPNGatewayConnectionDpdPrototype struct { - // Dead Peer Detection actions. - Action *string `json:"action,omitempty"` - - // Dead Peer Detection interval in seconds. - Interval *int64 `json:"interval,omitempty"` - - // Dead Peer Detection timeout in seconds. Must be at least the interval. - Timeout *int64 `json:"timeout,omitempty"` +// VPNServerAuthenticationByUsernameIDProvider : The type of identity provider to be used by VPN client. +// Models which "extend" this model: +// - VPNServerAuthenticationByUsernameIDProviderByIam +type VPNServerAuthenticationByUsernameIDProvider struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type,omitempty"` } -// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. -// Dead Peer Detection actions. +// Constants associated with the VPNServerAuthenticationByUsernameIDProvider.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. const ( - VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" - VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" - VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" - VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" + VPNServerAuthenticationByUsernameIDProviderProviderTypeIamConst = "iam" ) -// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionDpdPrototype) - err = core.UnmarshalPrimitive(m, "action", &obj.Action) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) +func (*VPNServerAuthenticationByUsernameIDProvider) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +type VPNServerAuthenticationByUsernameIDProviderIntf interface { + isaVPNServerAuthenticationByUsernameIDProvider() bool +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProvider unmarshals an instance of VPNServerAuthenticationByUsernameIDProvider from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProvider(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProvider) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) if err != nil { return } @@ -57950,67 +60739,145 @@ func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, res return } -// VPNGatewayConnectionIkePolicyPatch : The IKE policy to use. Specify `null` to remove any existing policy, [resulting in -// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). +// VPNServerAuthenticationPrototype : An authentication method for this VPN server. // Models which "extend" this model: -// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByID -// - VPNGatewayConnectionIkePolicyPatchIkePolicyIdentityByHref -type VPNGatewayConnectionIkePolicyPatch struct { - // The unique identifier for this IKE policy. - ID *string `json:"id,omitempty"` +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype +// - VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype +type VPNServerAuthenticationPrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` - // The IKE policy's canonical URL. - Href *string `json:"href,omitempty"` + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider,omitempty"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca,omitempty"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` } -func (*VPNGatewayConnectionIkePolicyPatch) isaVPNGatewayConnectionIkePolicyPatch() bool { +// Constants associated with the VPNServerAuthenticationPrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationPrototype) isaVPNServerAuthenticationPrototype() bool { return true } -type VPNGatewayConnectionIkePolicyPatchIntf interface { - isaVPNGatewayConnectionIkePolicyPatch() bool +type VPNServerAuthenticationPrototypeIntf interface { + isaVPNServerAuthenticationPrototype() bool } -// UnmarshalVPNGatewayConnectionIkePolicyPatch unmarshals an instance of VPNGatewayConnectionIkePolicyPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalVPNServerAuthenticationPrototype unmarshals an instance of VPNServerAuthenticationPrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "method", &discValue) if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'method': %s", err.Error()) return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { + if discValue == "" { + err = fmt.Errorf("required discriminator property 'method' not found in JSON object") return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if discValue == "certificate" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + } else if discValue == "username" { + err = core.UnmarshalModel(m, "", result, UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'method': %s", discValue) + } return } -// VPNGatewayConnectionIkePolicyPrototype : The IKE policy to use. If unspecified, [auto-negotiation will be -// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). -// Models which "extend" this model: -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByID -// - VPNGatewayConnectionIkePolicyPrototypeIkePolicyIdentityByHref -type VPNGatewayConnectionIkePolicyPrototype struct { - // The unique identifier for this IKE policy. - ID *string `json:"id,omitempty"` +// VPNServerClient : VPNServerClient struct +type VPNServerClient struct { + // The IP address assigned to this VPN client from `client_ip_pool`. + ClientIP *IP `json:"client_ip" validate:"required"` - // The IKE policy's canonical URL. - Href *string `json:"href,omitempty"` -} + // The common name of client certificate that the VPN client provided when connecting to the server. + // + // This property will be present only when the `certificate` client authentication method is enabled on the VPN server. + CommonName *string `json:"common_name,omitempty"` -func (*VPNGatewayConnectionIkePolicyPrototype) isaVPNGatewayConnectionIkePolicyPrototype() bool { - return true -} + // The date and time that the VPN client was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` -type VPNGatewayConnectionIkePolicyPrototypeIntf interface { - isaVPNGatewayConnectionIkePolicyPrototype() bool + // The date and time that the VPN client was disconnected. + // + // This property will be present only when the client `status` is `disconnected`. + DisconnectedAt *strfmt.DateTime `json:"disconnected_at,omitempty"` + + // The URL for this VPN client. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN client. + ID *string `json:"id" validate:"required"` + + // The remote IP address of this VPN client. + RemoteIP *IP `json:"remote_ip" validate:"required"` + + // The remote port of this VPN client. + RemotePort *int64 `json:"remote_port" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN client: + // - `connected`: the VPN client is `connected` to this VPN server. + // - `disconnected`: the VPN client is `disconnected` from this VPN server. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // The username that this VPN client provided when connecting to the VPN server. + // + // This property will be present only when the `username` client authentication method is enabled on the VPN server. + Username *string `json:"username,omitempty"` } -// UnmarshalVPNGatewayConnectionIkePolicyPrototype unmarshals an instance of VPNGatewayConnectionIkePolicyPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIkePolicyPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// Constants associated with the VPNServerClient.ResourceType property. +// The resource type. +const ( + VPNServerClientResourceTypeVPNServerClientConst = "vpn_server_client" +) + +// Constants associated with the VPNServerClient.Status property. +// The status of the VPN client: +// - `connected`: the VPN client is `connected` to this VPN server. +// - `disconnected`: the VPN client is `disconnected` from this VPN server. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN client on which the +// unexpected property value was encountered. +const ( + VPNServerClientStatusConnectedConst = "connected" + VPNServerClientStatusDisconnectedConst = "disconnected" +) + +// UnmarshalVPNServerClient unmarshals an instance of VPNServerClient from the specified map of raw messages. +func UnmarshalVPNServerClient(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClient) + err = core.UnmarshalModel(m, "client_ip", &obj.ClientIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "common_name", &obj.CommonName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disconnected_at", &obj.DisconnectedAt) if err != nil { return } @@ -58018,39 +60885,73 @@ func UnmarshalVPNGatewayConnectionIkePolicyPrototype(m map[string]json.RawMessag if err != nil { return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote_ip", &obj.RemoteIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "remote_port", &obj.RemotePort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// VPNGatewayConnectionIPsecPolicyPatch : The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in -// auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). -// Models which "extend" this model: -// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByID -// - VPNGatewayConnectionIPsecPolicyPatchIPsecPolicyIdentityByHref -type VPNGatewayConnectionIPsecPolicyPatch struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id,omitempty"` +// VPNServerClientCollection : VPNServerClientCollection struct +type VPNServerClientCollection struct { + // Collection of VPN clients. + Clients []VPNServerClient `json:"clients" validate:"required"` - // The IPsec policy's canonical URL. - Href *string `json:"href,omitempty"` -} + // A link to the first page of resources. + First *VPNServerClientCollectionFirst `json:"first" validate:"required"` -func (*VPNGatewayConnectionIPsecPolicyPatch) isaVPNGatewayConnectionIPsecPolicyPatch() bool { - return true -} + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -type VPNGatewayConnectionIPsecPolicyPatchIntf interface { - isaVPNGatewayConnectionIPsecPolicyPatch() bool + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNServerClientCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` } -// UnmarshalVPNGatewayConnectionIPsecPolicyPatch unmarshals an instance of VPNGatewayConnectionIPsecPolicyPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPatch) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) +// UnmarshalVPNServerClientCollection unmarshals an instance of VPNServerClientCollection from the specified map of raw messages. +func UnmarshalVPNServerClientCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollection) + err = core.UnmarshalModel(m, "clients", &obj.Clients, UnmarshalVPNServerClient) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerClientCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerClientCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -58058,34 +60959,27 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPatch(m map[string]json.RawMessage, return } -// VPNGatewayConnectionIPsecPolicyPrototype : The IPsec policy to use. If unspecified, [auto-negotiation will be -// used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). -// Models which "extend" this model: -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByID -// - VPNGatewayConnectionIPsecPolicyPrototypeIPsecPolicyIdentityByHref -type VPNGatewayConnectionIPsecPolicyPrototype struct { - // The unique identifier for this IPsec policy. - ID *string `json:"id,omitempty"` - - // The IPsec policy's canonical URL. - Href *string `json:"href,omitempty"` -} - -func (*VPNGatewayConnectionIPsecPolicyPrototype) isaVPNGatewayConnectionIPsecPolicyPrototype() bool { - return true +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNServerClientCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil } -type VPNGatewayConnectionIPsecPolicyPrototypeIntf interface { - isaVPNGatewayConnectionIPsecPolicyPrototype() bool +// VPNServerClientCollectionFirst : A link to the first page of resources. +type VPNServerClientCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` } -// UnmarshalVPNGatewayConnectionIPsecPolicyPrototype unmarshals an instance of VPNGatewayConnectionIPsecPolicyPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionIPsecPolicyPrototype) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } +// UnmarshalVPNServerClientCollectionFirst unmarshals an instance of VPNServerClientCollectionFirst from the specified map of raw messages. +func UnmarshalVPNServerClientCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollectionFirst) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -58094,16 +60988,16 @@ func UnmarshalVPNGatewayConnectionIPsecPolicyPrototype(m map[string]json.RawMess return } -// VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct -type VPNGatewayConnectionLocalCIDRs struct { - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` +// VPNServerClientCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNServerClientCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` } -// UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionLocalCIDRs) - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) +// UnmarshalVPNServerClientCollectionNext unmarshals an instance of VPNServerClientCollectionNext from the specified map of raw messages. +func UnmarshalVPNServerClientCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerClientCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -58111,83 +61005,74 @@ func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, resul return } -// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct -// Models which "extend" this model: -// - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch -type VPNGatewayConnectionPatch struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` - - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpdPatch `json:"dead_peer_detection,omitempty"` - - // The IKE policy to use. Specify `null` to remove any existing policy, [resulting in - // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy VPNGatewayConnectionIkePolicyPatchIntf `json:"ike_policy,omitempty"` - - // The IPsec policy to use. Specify `null` to remove any existing policy, [resulting in - // auto-negotiation](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy VPNGatewayConnectionIPsecPolicyPatchIntf `json:"ipsec_policy,omitempty"` - - // The user-defined name for this VPN gateway connection. - Name *string `json:"name,omitempty"` - - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address,omitempty"` - - // The preshared key. - Psk *string `json:"psk,omitempty"` +// VPNServerCollection : VPNServerCollection struct +type VPNServerCollection struct { + // A link to the first page of resources. + First *VPNServerCollectionFirst `json:"first" validate:"required"` - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` -} + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` -// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. -const ( - VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" -) + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNServerCollectionNext `json:"next,omitempty"` -func (*VPNGatewayConnectionPatch) isaVPNGatewayConnectionPatch() bool { - return true -} + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` -type VPNGatewayConnectionPatchIntf interface { - isaVPNGatewayConnectionPatch() bool + // Collection of VPN servers. + VPNServers []VPNServer `json:"vpn_servers" validate:"required"` } -// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPatch) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) +// UnmarshalVPNServerCollection unmarshals an instance of VPNServerCollection from the specified map of raw messages. +func UnmarshalVPNServerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerCollectionFirst) if err != nil { return } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPatch) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPatch) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerCollectionNext) if err != nil { return } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalModel(m, "vpn_servers", &obj.VPNServers, UnmarshalVPNServer) if err != nil { return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) - if err != nil { - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNServerCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) - if err != nil { - return + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + return start, nil +} + +// VPNServerCollectionFirst : A link to the first page of resources. +type VPNServerCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNServerCollectionFirst unmarshals an instance of VPNServerCollectionFirst from the specified map of raw messages. +func UnmarshalVPNServerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -58195,26 +61080,16 @@ func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result int return } -// AsPatch returns a generic map representation of the VPNGatewayConnectionPatch -func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayConnectionPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) - } - return -} - -// VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct -type VPNGatewayConnectionPeerCIDRs struct { - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` +// VPNServerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNServerCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` } -// UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPeerCIDRs) - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) +// UnmarshalVPNServerCollectionNext unmarshals an instance of VPNServerCollectionNext from the specified map of raw messages. +func UnmarshalVPNServerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -58222,98 +61097,99 @@ func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result return } -// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct -// Models which "extend" this model: -// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype -// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype -type VPNGatewayConnectionPrototype struct { - // If set to false, the VPN gateway connection is shut down. - AdminStateUp *bool `json:"admin_state_up,omitempty"` +// VPNServerPatch : VPNServerPatch struct +type VPNServerPatch struct { + // The certificate instance for this VPN server. + Certificate CertificateInstanceIdentityIntf `json:"certificate,omitempty"` - // The Dead Peer Detection settings. - DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + // The authentication methods to use to authenticate VPN client on this VPN server + // (replacing any existing methods). + ClientAuthentication []VPNServerAuthenticationPrototypeIntf `json:"client_authentication,omitempty"` - // The IKE policy to use. If unspecified, [auto-negotiation will be - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ike-auto-negotiation-phase-1). - IkePolicy VPNGatewayConnectionIkePolicyPrototypeIntf `json:"ike_policy,omitempty"` + // The DNS server addresses that will be provided to VPN clients connected to this VPN server (replacing any existing + // addresses). + ClientDnsServerIps []IP `json:"client_dns_server_ips,omitempty"` - // The IPsec policy to use. If unspecified, [auto-negotiation will be - // used](https://cloud.ibm.com/docs/vpc?topic=vpc-using-vpn&interface=ui#ipsec-auto-negotiation-phase-2). - IpsecPolicy VPNGatewayConnectionIPsecPolicyPrototypeIntf `json:"ipsec_policy,omitempty"` + // The seconds a VPN client can be idle before this VPN server will disconnect it. If `0`, the server will not + // disconnect idle clients. + ClientIdleTimeout *int64 `json:"client_idle_timeout,omitempty"` - // The user-defined name for this VPN gateway connection. - Name *string `json:"name,omitempty"` + // The VPN client IPv4 address pool, expressed in CIDR format. The request must not overlap with any existing address + // prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the client IP address pool's CIDR must be between + // `/9` (8,388,608 addresses) and `/22` (1024 addresses). A CIDR block that contains twice the number of IP addresses + // that are required to enable the maximum number of concurrent connections is recommended. + ClientIPPool *string `json:"client_ip_pool,omitempty"` - // The IP address of the peer VPN gateway. - PeerAddress *string `json:"peer_address" validate:"required"` + // Indicates whether the split tunneling is enabled on this VPN server. + EnableSplitTunneling *bool `json:"enable_split_tunneling,omitempty"` - // The preshared key. - Psk *string `json:"psk" validate:"required"` + // The user-defined name for this VPN server. Names must be unique within the VPC this VPN server is serving. + Name *string `json:"name,omitempty"` - // Routing protocols are disabled for this VPN gateway connection. - RoutingProtocol *string `json:"routing_protocol,omitempty"` + // The port number used by this VPN server. + Port *int64 `json:"port,omitempty"` - // The local CIDRs for this resource. - LocalCIDRs []string `json:"local_cidrs,omitempty"` + // The transport protocol used by this VPN server. + Protocol *string `json:"protocol,omitempty"` - // The peer CIDRs for this resource. - PeerCIDRs []string `json:"peer_cidrs,omitempty"` + // The subnets to provision this VPN server in (replacing the existing subnets). + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` } -// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. -// Routing protocols are disabled for this VPN gateway connection. +// Constants associated with the VPNServerPatch.Protocol property. +// The transport protocol used by this VPN server. const ( - VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" + VPNServerPatchProtocolTCPConst = "tcp" + VPNServerPatchProtocolUDPConst = "udp" ) -func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { - return true -} - -type VPNGatewayConnectionPrototypeIntf interface { - isaVPNGatewayConnectionPrototype() bool -} - -// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionPrototype) - err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) +// UnmarshalVPNServerPatch unmarshals an instance of VPNServerPatch from the specified map of raw messages. +func UnmarshalVPNServerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerPatch) + err = core.UnmarshalModel(m, "certificate", &obj.Certificate, UnmarshalCertificateInstanceIdentity) if err != nil { return } - err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + err = core.UnmarshalModel(m, "client_authentication", &obj.ClientAuthentication, UnmarshalVPNServerAuthenticationPrototype) if err != nil { return } - err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalVPNGatewayConnectionIkePolicyPrototype) + err = core.UnmarshalModel(m, "client_dns_server_ips", &obj.ClientDnsServerIps, UnmarshalIP) if err != nil { return } - err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalVPNGatewayConnectionIPsecPolicyPrototype) + err = core.UnmarshalPrimitive(m, "client_idle_timeout", &obj.ClientIdleTimeout) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "client_ip_pool", &obj.ClientIPPool) if err != nil { return } - err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + err = core.UnmarshalPrimitive(m, "enable_split_tunneling", &obj.EnableSplitTunneling) if err != nil { return } - err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { return } - err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) if err != nil { return } - err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) if err != nil { return } @@ -58321,100 +61197,134 @@ func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result return } -// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct -type VPNGatewayConnectionReference struct { - // If present, this property indicates the referenced resource has been deleted and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` +// AsPatch returns a generic map representation of the VPNServerPatch +func (vpnServerPatch *VPNServerPatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnServerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} - // The VPN connection's canonical URL. +// VPNServerReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VPNServerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNServerReferenceDeleted unmarshals an instance of VPNServerReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNServerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerRoute : VPNServerRoute struct +type VPNServerRoute struct { + // The action to perform with a packet matching the VPN route: + // - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. + // - `deliver`: deliver the packet into the VPC. + // - `drop`: drop the packet + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the + // unexpected property value was encountered. + Action *string `json:"action" validate:"required"` + + // The date and time that the VPN route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination for this VPN route in the VPN server. If an incoming packet does not match any destination, it will + // be dropped. + Destination *string `json:"destination" validate:"required"` + + // The URL for this VPN route. Href *string `json:"href" validate:"required"` - // The unique identifier for this VPN gateway connection. + // The unique identifier for this VPN route. ID *string `json:"id" validate:"required"` - // The user-defined name for this VPN connection. + // The lifecycle state of the VPN route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The user-defined name for this VPN route. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the VPNGatewayConnectionReference.ResourceType property. +// Constants associated with the VPNServerRoute.Action property. +// The action to perform with a packet matching the VPN route: +// - `translate`: translate the source IP address to one of the private IP addresses of the VPN server. +// - `deliver`: deliver the packet into the VPC. +// - `drop`: drop the packet +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the VPN route on which the +// unexpected property value was encountered. +const ( + VPNServerRouteActionDeliverConst = "deliver" + VPNServerRouteActionDropConst = "drop" + VPNServerRouteActionTranslateConst = "translate" +) + +// Constants associated with the VPNServerRoute.LifecycleState property. +// The lifecycle state of the VPN route. +const ( + VPNServerRouteLifecycleStateDeletingConst = "deleting" + VPNServerRouteLifecycleStateFailedConst = "failed" + VPNServerRouteLifecycleStatePendingConst = "pending" + VPNServerRouteLifecycleStateStableConst = "stable" + VPNServerRouteLifecycleStateSuspendedConst = "suspended" + VPNServerRouteLifecycleStateUpdatingConst = "updating" + VPNServerRouteLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the VPNServerRoute.ResourceType property. // The resource type. const ( - VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" + VPNServerRouteResourceTypeVPNServerRouteConst = "vpn_server_route" ) -// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) +// UnmarshalVPNServerRoute unmarshals an instance of VPNServerRoute from the specified map of raw messages. +func UnmarshalVPNServerRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoute) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) if err != nil { return } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) if err != nil { return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary -// information. -type VPNGatewayConnectionReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` -} - -// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct -type VPNGatewayConnectionStaticRouteModeTunnel struct { - // The IP address of the VPN gateway member in which the tunnel resides. - PublicIP *IP `json:"public_ip" validate:"required"` - - // The status of the VPN Tunnel. - Status *string `json:"status" validate:"required"` -} - -// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. -// The status of the VPN Tunnel. -const ( - VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" - VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" -) - -// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. -func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayConnectionStaticRouteModeTunnel) - err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) if err != nil { return } @@ -58422,72 +61332,45 @@ func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMes return } -// VPNGatewayMember : VPNGatewayMember struct -type VPNGatewayMember struct { - // The private IP address assigned to the VPN gateway member. - // - // This property will be present only when the VPN gateway status is `available`. - PrivateIP *IP `json:"private_ip,omitempty"` - - // The public IP address assigned to the VPN gateway member. - PublicIP *IP `json:"public_ip" validate:"required"` +// VPNServerRouteCollection : VPNServerRouteCollection struct +type VPNServerRouteCollection struct { + // A link to the first page of resources. + First *VPNServerRouteCollectionFirst `json:"first" validate:"required"` - // The high availability role assigned to the VPN gateway member. - Role *string `json:"role" validate:"required"` + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` - // The status of the VPN gateway member. - Status *string `json:"status" validate:"required"` -} + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNServerRouteCollectionNext `json:"next,omitempty"` -// Constants associated with the VPNGatewayMember.Role property. -// The high availability role assigned to the VPN gateway member. -const ( - VPNGatewayMemberRoleActiveConst = "active" - VPNGatewayMemberRoleStandbyConst = "standby" -) + // Collection of VPN routes. + Routes []VPNServerRoute `json:"routes" validate:"required"` -// Constants associated with the VPNGatewayMember.Status property. -// The status of the VPN gateway member. -const ( - VPNGatewayMemberStatusAvailableConst = "available" - VPNGatewayMemberStatusDeletingConst = "deleting" - VPNGatewayMemberStatusFailedConst = "failed" - VPNGatewayMemberStatusPendingConst = "pending" -) + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} -// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. -func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayMember) - err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalIP) +// UnmarshalVPNServerRouteCollection unmarshals an instance of VPNServerRouteCollection from the specified map of raw messages. +func UnmarshalVPNServerRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNServerRouteCollectionFirst) if err != nil { return } - err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { return } - err = core.UnmarshalPrimitive(m, "role", &obj.Role) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNServerRouteCollectionNext) if err != nil { return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalVPNServerRoute) if err != nil { return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// VPNGatewayPatch : VPNGatewayPatch struct -type VPNGatewayPatch struct { - // The user-defined name for this VPN gateway. - Name *string `json:"name,omitempty"` -} - -// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. -func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPatch) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { return } @@ -58495,65 +61378,45 @@ func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) return } -// AsPatch returns a generic map representation of the VPNGatewayPatch -func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (_patch map[string]interface{}, err error) { - var jsonData []byte - jsonData, err = json.Marshal(vpnGatewayPatch) - if err == nil { - err = json.Unmarshal(jsonData, &_patch) +// Retrieve the value to be passed to a request to access the next page of results +func (resp *VPNServerRouteCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil } - return + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil || start == nil { + return nil, err + } + return start, nil } -// VPNGatewayPrototype : VPNGatewayPrototype struct -// Models which "extend" this model: -// - VPNGatewayPrototypeVPNGatewayRouteModePrototype -// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype -type VPNGatewayPrototype struct { - // The user-defined name for this VPN gateway. - Name *string `json:"name,omitempty"` - - // The resource group to use. If unspecified, the account's [default resource - // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` - - // Identifies a subnet by a unique property. - Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` - - // Route mode VPN gateway. - Mode *string `json:"mode,omitempty"` +// VPNServerRouteCollectionFirst : A link to the first page of resources. +type VPNServerRouteCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` } -// Constants associated with the VPNGatewayPrototype.Mode property. -// Route mode VPN gateway. -const ( - VPNGatewayPrototypeModeRouteConst = "route" -) - -func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { - return true +// UnmarshalVPNServerRouteCollectionFirst unmarshals an instance of VPNServerRouteCollectionFirst from the specified map of raw messages. +func UnmarshalVPNServerRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -type VPNGatewayPrototypeIntf interface { - isaVPNGatewayPrototype() bool +// VPNServerRouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNServerRouteCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` } -// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. -func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayPrototype) - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) - if err != nil { - return - } - err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) +// UnmarshalVPNServerRouteCollectionNext unmarshals an instance of VPNServerRouteCollectionNext from the specified map of raw messages. +func UnmarshalVPNServerRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRouteCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return } @@ -58561,17 +61424,16 @@ func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface return } -// VPNGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary -// information. -type VPNGatewayReferenceDeleted struct { - // Link to documentation about deleted resources. - MoreInfo *string `json:"more_info" validate:"required"` +// VPNServerRoutePatch : VPNServerRoutePatch struct +type VPNServerRoutePatch struct { + // The user-defined name for this VPN route. Names must be unique within the VPN server the VPN route resides in. + Name *string `json:"name,omitempty"` } -// UnmarshalVPNGatewayReferenceDeleted unmarshals an instance of VPNGatewayReferenceDeleted from the specified map of raw messages. -func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(VPNGatewayReferenceDeleted) - err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) +// UnmarshalVPNServerRoutePatch unmarshals an instance of VPNServerRoutePatch from the specified map of raw messages. +func UnmarshalVPNServerRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerRoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { return } @@ -58579,6 +61441,16 @@ func UnmarshalVPNGatewayReferenceDeleted(m map[string]json.RawMessage, result in return } +// AsPatch returns a generic map representation of the VPNServerRoutePatch +func (vpnServerRoutePatch *VPNServerRoutePatch) AsPatch() (_patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnServerRoutePatch) + if err == nil { + err = json.Unmarshal(jsonData, &_patch) + } + return +} + // Volume : Volume struct type Volume struct { // Indicates whether a running virtual server instance has an attachment to this volume. @@ -59807,6 +62679,7 @@ func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interf // VolumePrototype : VolumePrototype struct // Models which "extend" this model: // - VolumePrototypeVolumeByCapacity +// - VolumePrototypeVolumeBySourceSnapshot type VolumePrototype struct { // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile // `family` of `custom`. @@ -59836,6 +62709,9 @@ type VolumePrototype struct { // // If unspecified, the `encryption` type for the volume will be `provider_managed`. EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot,omitempty"` } func (*VolumePrototype) isaVolumePrototype() bool { @@ -59881,6 +62757,10 @@ func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) if err != nil { return } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } @@ -71511,40 +74391,327 @@ func UnmarshalReservedIPTargetLoadBalancerReference(m map[string]json.RawMessage return } -// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { +// ReservedIPTargetNetworkInterfaceReferenceTargetContext : ReservedIPTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetVPNServerReference : ReservedIPTargetVPNServerReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPN server. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN server. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPN server. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetVPNServerReference.ResourceType property. +// The resource type. +const ( + ReservedIPTargetVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" +) + +func (*ReservedIPTargetVPNServerReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetVPNServerReference unmarshals an instance of ReservedIPTargetVPNServerReference from the specified map of raw messages. +func UnmarshalReservedIPTargetVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct +// This model "extends" ResourceGroupIdentity +type ResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { + _model = &ResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { + return true +} + +// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNGatewayReference : RouteCreatorVPNGatewayReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNGatewayReference struct { + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteCreatorVPNGatewayReference.ResourceType property. +// The resource type. +const ( + RouteCreatorVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" +) + +func (*RouteCreatorVPNGatewayReference) isaRouteCreator() bool { + return true +} + +// UnmarshalRouteCreatorVPNGatewayReference unmarshals an instance of RouteCreatorVPNGatewayReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCreatorVPNServerReference : RouteCreatorVPNServerReference struct +// This model "extends" RouteCreator +type RouteCreatorVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + // If present, this property indicates the referenced resource has been deleted and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this VPN server. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The unique user-defined name for this VPN server. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the ReservedIPTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// Constants associated with the RouteCreatorVPNServerReference.ResourceType property. // The resource type. const ( - ReservedIPTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" + RouteCreatorVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" ) -func (*ReservedIPTargetNetworkInterfaceReferenceTargetContext) isaReservedIPTarget() bool { +func (*RouteCreatorVPNServerReference) isaRouteCreator() bool { return true } -// UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of ReservedIPTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) +// UnmarshalRouteCreatorVPNServerReference unmarshals an instance of RouteCreatorVPNServerReference from the specified map of raw messages. +func UnmarshalRouteCreatorVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCreatorVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) if err != nil { return } @@ -71568,47 +74735,66 @@ func UnmarshalReservedIPTargetNetworkInterfaceReferenceTargetContext(m map[strin return } -// ReservedIPTargetVPNGatewayReference : ReservedIPTargetVPNGatewayReference struct -// This model "extends" ReservedIPTarget -type ReservedIPTargetVPNGatewayReference struct { - // The VPN gateway's CRN. - CRN *string `json:"crn" validate:"required"` +// RouteNextHopIP : RouteNextHopIP struct +// This model "extends" RouteNextHop +type RouteNextHopIP struct { + // The IP address. + // + // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify + // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the + // error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*RouteNextHopIP) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} +// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct +// This model "extends" RouteNextHop +type RouteNextHopVPNGatewayConnectionReference struct { // If present, this property indicates the referenced resource has been deleted and provides // some supplementary information. - Deleted *VPNGatewayReferenceDeleted `json:"deleted,omitempty"` + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - // The VPN gateway's canonical URL. + // The VPN connection's canonical URL. Href *string `json:"href" validate:"required"` - // The unique identifier for this VPN gateway. + // The unique identifier for this VPN gateway connection. ID *string `json:"id" validate:"required"` - // The user-defined name for this VPN gateway. + // The user-defined name for this VPN connection. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the ReservedIPTargetVPNGatewayReference.ResourceType property. +// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. // The resource type. const ( - ReservedIPTargetVPNGatewayReferenceResourceTypeVPNGatewayConst = "vpn_gateway" + RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" ) -func (*ReservedIPTargetVPNGatewayReference) isaReservedIPTarget() bool { +func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { return true } -// UnmarshalReservedIPTargetVPNGatewayReference unmarshals an instance of ReservedIPTargetVPNGatewayReference from the specified map of raw messages. -func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReservedIPTargetVPNGatewayReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayReferenceDeleted) +// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopVPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) if err != nil { return } @@ -71632,40 +74818,9 @@ func UnmarshalReservedIPTargetVPNGatewayReference(m map[string]json.RawMessage, return } -// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct -// This model "extends" ResourceGroupIdentity -type ResourceGroupIdentityByID struct { - // The unique identifier for this resource group. - ID *string `json:"id" validate:"required"` -} - -// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) -func (*VpcV1) NewResourceGroupIdentityByID(id string) (_model *ResourceGroupIdentityByID, err error) { - _model = &ResourceGroupIdentityByID{ - ID: core.StringPtr(id), - } - err = core.ValidateStruct(_model, "required parameters") - return -} - -func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { - return true -} - -// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. -func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResourceGroupIdentityByID) - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopIP : RouteNextHopIP struct -// This model "extends" RouteNextHop -type RouteNextHopIP struct { +// RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : The IP address of the next hop to which to route packets. +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP struct { // The IP address. // // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify @@ -71674,48 +74829,22 @@ type RouteNextHopIP struct { Address *string `json:"address" validate:"required"` } -func (*RouteNextHopIP) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopIP) - err = core.UnmarshalPrimitive(m, "address", &obj.Address) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// RouteNextHopPrototypeRouteNextHopIP : The IP address of the next hop to which to route packets. -// This model "extends" RouteNextHopPrototype -type RouteNextHopPrototypeRouteNextHopIP struct { - // The IP address. - // - // This property may add support for IPv6 addresses in the future. When processing a value in this property, verify - // that the address is in an expected format. If it is not, log an error. Optionally halt processing and surface the - // error, or bypass the resource on which the unexpected IP address format was encountered. - Address *string `json:"address" validate:"required"` -} - -// NewRouteNextHopPrototypeRouteNextHopIP : Instantiate RouteNextHopPrototypeRouteNextHopIP (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPrototypeRouteNextHopIP(address string) (_model *RouteNextHopPrototypeRouteNextHopIP, err error) { - _model = &RouteNextHopPrototypeRouteNextHopIP{ +// NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(address string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ Address: core.StringPtr(address), } err = core.ValidateStruct(_model, "required parameters") return } -func (*RouteNextHopPrototypeRouteNextHopIP) isaRouteNextHopPrototype() bool { +func (*RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) isaRoutePrototypeNextHop() bool { return true } -// UnmarshalRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. -func UnmarshalRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPrototypeRouteNextHopIP) +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) err = core.UnmarshalPrimitive(m, "address", &obj.Address) if err != nil { return @@ -71724,12 +74853,12 @@ func UnmarshalRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, return } -// RouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. // Models which "extend" this model: -// - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID -// - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref -// This model "extends" RouteNextHopPrototype -type RouteNextHopPrototypeVPNGatewayConnectionIdentity struct { +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RoutePrototypeNextHop +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id,omitempty"` @@ -71737,22 +74866,22 @@ type RouteNextHopPrototypeVPNGatewayConnectionIdentity struct { Href *string `json:"href,omitempty"` } -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { return true } -type RouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { - RouteNextHopPrototypeIntf - isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { + RoutePrototypeNextHopIntf + isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool } -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRouteNextHopPrototype() bool { +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRoutePrototypeNextHop() bool { return true } -// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. -func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentity) +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return @@ -71765,63 +74894,6 @@ func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]jso return } -// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct -// This model "extends" RouteNextHop -type RouteNextHopVPNGatewayConnectionReference struct { - // If present, this property indicates the referenced resource has been deleted and provides - // some supplementary information. - Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` - - // The VPN connection's canonical URL. - Href *string `json:"href" validate:"required"` - - // The unique identifier for this VPN gateway connection. - ID *string `json:"id" validate:"required"` - - // The user-defined name for this VPN connection. - Name *string `json:"name" validate:"required"` - - // The resource type. - ResourceType *string `json:"resource_type" validate:"required"` -} - -// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. -// The resource type. -const ( - RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" -) - -func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { - return true -} - -// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. -func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopVPNGatewayConnectionReference) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "href", &obj.Href) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // RoutingTableIdentityByHref : RoutingTableIdentityByHref struct // This model "extends" RoutingTableIdentity type RoutingTableIdentityByHref struct { @@ -72918,47 +75990,104 @@ func UnmarshalSecurityGroupTargetReferenceEndpointGatewayReference(m map[string] return } -// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" +) + +func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct // This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceLoadBalancerReference struct { - // The load balancer's CRN. - CRN *string `json:"crn" validate:"required"` - +type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { // If present, this property indicates the referenced resource has been deleted and provides // some supplementary information. - Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` - // The load balancer's canonical URL. + // The URL for this network interface. Href *string `json:"href" validate:"required"` - // The unique identifier for this load balancer. + // The unique identifier for this network interface. ID *string `json:"id" validate:"required"` - // The unique user-defined name for this load balancer. + // The user-defined name for this network interface. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the SecurityGroupTargetReferenceLoadBalancerReference.ResourceType property. +// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. // The resource type. const ( - SecurityGroupTargetReferenceLoadBalancerReferenceResourceTypeLoadBalancerConst = "load_balancer" + SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" ) -func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { +func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceLoadBalancerReference) - err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) - if err != nil { - return - } - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) +// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) if err != nil { return } @@ -72982,40 +76111,47 @@ func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]jso return } -// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct +// SecurityGroupTargetReferenceVPNServerReference : SecurityGroupTargetReferenceVPNServerReference struct // This model "extends" SecurityGroupTargetReference -type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { +type SecurityGroupTargetReferenceVPNServerReference struct { + // The CRN for this VPN server. + CRN *string `json:"crn" validate:"required"` + // If present, this property indicates the referenced resource has been deleted and provides // some supplementary information. - Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + Deleted *VPNServerReferenceDeleted `json:"deleted,omitempty"` - // The URL for this network interface. + // The URL for this VPN server. Href *string `json:"href" validate:"required"` - // The unique identifier for this network interface. + // The unique identifier for this VPN server. ID *string `json:"id" validate:"required"` - // The user-defined name for this network interface. + // The unique user-defined name for this VPN server. Name *string `json:"name" validate:"required"` // The resource type. ResourceType *string `json:"resource_type" validate:"required"` } -// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. +// Constants associated with the SecurityGroupTargetReferenceVPNServerReference.ResourceType property. // The resource type. const ( - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" + SecurityGroupTargetReferenceVPNServerReferenceResourceTypeVPNServerConst = "vpn_server" ) -func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { +func (*SecurityGroupTargetReferenceVPNServerReference) isaSecurityGroupTargetReference() bool { return true } -// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. -func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) - err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) +// UnmarshalSecurityGroupTargetReferenceVPNServerReference unmarshals an instance of SecurityGroupTargetReferenceVPNServerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceVPNServerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceVPNServerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNServerReferenceDeleted) if err != nil { return } @@ -74892,6 +78028,231 @@ func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface return } +// VPNServerAuthenticationByCertificate : VPNServerAuthenticationByCertificate struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByCertificate struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance used for the VPN client certificate authority (CA). + ClientCa *CertificateInstanceReference `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationByCertificate.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByCertificateMethodCertificateConst = "certificate" + VPNServerAuthenticationByCertificateMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByCertificate) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByCertificate unmarshals an instance of VPNServerAuthenticationByCertificate from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByCertificate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByCertificate) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsername : VPNServerAuthenticationByUsername struct +// This model "extends" VPNServerAuthentication +type VPNServerAuthenticationByUsername struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsername.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationByUsernameMethodCertificateConst = "certificate" + VPNServerAuthenticationByUsernameMethodUsernameConst = "username" +) + +func (*VPNServerAuthenticationByUsername) isaVPNServerAuthentication() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsername unmarshals an instance of VPNServerAuthenticationByUsername from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsername(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsername) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationByUsernameIDProviderByIam : VPNServerAuthenticationByUsernameIDProviderByIam struct +// This model "extends" VPNServerAuthenticationByUsernameIDProvider +type VPNServerAuthenticationByUsernameIDProviderByIam struct { + // The type of identity provider to be used by the VPN client. + // - `iam`: IBM identity and access management + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the + // unexpected property value was encountered. + ProviderType *string `json:"provider_type" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationByUsernameIDProviderByIam.ProviderType property. +// The type of identity provider to be used by the VPN client. +// - `iam`: IBM identity and access management +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the route on which the +// unexpected property value was encountered. +const ( + VPNServerAuthenticationByUsernameIDProviderByIamProviderTypeIamConst = "iam" +) + +// NewVPNServerAuthenticationByUsernameIDProviderByIam : Instantiate VPNServerAuthenticationByUsernameIDProviderByIam (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType string) (_model *VPNServerAuthenticationByUsernameIDProviderByIam, err error) { + _model = &VPNServerAuthenticationByUsernameIDProviderByIam{ + ProviderType: core.StringPtr(providerType), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationByUsernameIDProviderByIam) isaVPNServerAuthenticationByUsernameIDProvider() bool { + return true +} + +// UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam unmarshals an instance of VPNServerAuthenticationByUsernameIDProviderByIam from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationByUsernameIDProviderByIam(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationByUsernameIDProviderByIam) + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The certificate instance to use for the VPN client certificate authority (CA). + ClientCa CertificateInstanceIdentityIntf `json:"client_ca" validate:"required"` + + // The certificate revocation list contents, encoded in PEM format. + Crl *string `json:"crl,omitempty"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method string, clientCa CertificateInstanceIdentityIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype{ + Method: core.StringPtr(method), + ClientCa: clientCa, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "client_ca", &obj.ClientCa, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crl", &obj.Crl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct +// This model "extends" VPNServerAuthenticationPrototype +type VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype struct { + // The type of authentication. + Method *string `json:"method" validate:"required"` + + // The type of identity provider to be used by VPN client. + IdentityProvider VPNServerAuthenticationByUsernameIDProviderIntf `json:"identity_provider" validate:"required"` +} + +// Constants associated with the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype.Method property. +// The type of authentication. +const ( + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodCertificateConst = "certificate" + VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototypeMethodUsernameConst = "username" +) + +// NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype : Instantiate VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method string, identityProvider VPNServerAuthenticationByUsernameIDProviderIntf) (_model *VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype, err error) { + _model = &VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ + Method: core.StringPtr(method), + IdentityProvider: identityProvider, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) isaVPNServerAuthenticationPrototype() bool { + return true +} + +// UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype unmarshals an instance of VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype from the specified map of raw messages. +func UnmarshalVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + err = core.UnmarshalPrimitive(m, "method", &obj.Method) + if err != nil { + return + } + err = core.UnmarshalModel(m, "identity_provider", &obj.IdentityProvider, UnmarshalVPNServerAuthenticationByUsernameIDProvider) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // VolumeAttachmentPrototypeVolumeVolumeIdentity : Identifies a volume by a unique property. // Models which "extend" this model: // - VolumeAttachmentPrototypeVolumeVolumeIdentityVolumeIdentityByID @@ -75376,6 +78737,100 @@ func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, resu return } +// VolumePrototypeVolumeBySourceSnapshot : VolumePrototypeVolumeBySourceSnapshot struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeBySourceSnapshot struct { + // The maximum I/O operations per second (IOPS) to use for the volume. Applicable only to volumes using a profile + // `family` of `custom`. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The [user tags](https://cloud.ibm.com/apidocs/tagging#types-of-tags) associated with this volume. + UserTags []string `json:"user_tags,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity to use for the volume (in gigabytes). Must be at least the snapshot's + // `minimum_capacity`. The maximum value may increase in the future. + // + // If unspecified, the capacity will be the source snapshot's `minimum_capacity`. + Capacity *int64 `json:"capacity,omitempty"` + + // The root key to use to wrap the data encryption key for the volume. + // + // If unspecified, the snapshot's `encryption_key` will be used. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The snapshot from which to clone the volume. + SourceSnapshot SnapshotIdentityIntf `json:"source_snapshot" validate:"required"` +} + +// NewVolumePrototypeVolumeBySourceSnapshot : Instantiate VolumePrototypeVolumeBySourceSnapshot (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeBySourceSnapshot(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, sourceSnapshot SnapshotIdentityIntf) (_model *VolumePrototypeVolumeBySourceSnapshot, err error) { + _model = &VolumePrototypeVolumeBySourceSnapshot{ + Profile: profile, + Zone: zone, + SourceSnapshot: sourceSnapshot, + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +func (*VolumePrototypeVolumeBySourceSnapshot) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeBySourceSnapshot unmarshals an instance of VolumePrototypeVolumeBySourceSnapshot from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeBySourceSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeBySourceSnapshot) + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_tags", &obj.UserTags) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_snapshot", &obj.SourceSnapshot, UnmarshalSnapshotIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ZoneIdentityByHref : ZoneIdentityByHref struct // This model "extends" ZoneIdentity type ZoneIdentityByHref struct { @@ -77602,33 +81057,33 @@ func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIde return } -// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct -// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity -type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { // The VPN connection's canonical URL. Href *string `json:"href" validate:"required"` } -// NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { - _model = &RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ Href: core.StringPtr(href), } err = core.ValidateStruct(_model, "required parameters") return } -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { return true } -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototype() bool { +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRoutePrototypeNextHop() bool { return true } -// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. -func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) err = core.UnmarshalPrimitive(m, "href", &obj.Href) if err != nil { return @@ -77637,33 +81092,33 @@ func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnect return } -// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct -// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity -type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { +// RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity +type RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { // The unique identifier for this VPN gateway connection. ID *string `json:"id" validate:"required"` } -// NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) -func (*VpcV1) NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { - _model = &RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ +// NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (_model *RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + _model = &RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ ID: core.StringPtr(id), } err = core.ValidateStruct(_model, "required parameters") return } -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { return true } -func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototype() bool { +func (*RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRoutePrototypeNextHop() bool { return true } -// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. -func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) +// UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { return diff --git a/vpcv1/vpc_v1_examples_test.go b/vpcv1/vpc_v1_examples_test.go index 73bc709..ecde4ed 100644 --- a/vpcv1/vpc_v1_examples_test.go +++ b/vpcv1/vpc_v1_examples_test.go @@ -53,7 +53,9 @@ var ( reservedIPID string reservedIPID2 string ifMatchVolume string + ifMatchBackupPolicy string ifMatchSnapshot string + ifMatchVPNServer string instanceTemplateID string instanceGroupID string instanceGroupManagerID string @@ -95,6 +97,9 @@ var ( bareMetalServerId string bareMetalServerDiskId string bareMetalServerNetworkInterfaceId string + vpnClientID string + vpnServerRouteID string + vpnServerID string ) func skipTest() { @@ -408,7 +413,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { // begin-create_vpc_routing_table routePrototypeModel := &vpcv1.RoutePrototype{ Action: &action, - NextHop: &vpcv1.RouteNextHopPrototypeRouteNextHopIP{ + NextHop: &vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ Address: &[]string{"192.168.3.4"}[0], }, Name: &routeName, @@ -510,7 +515,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { RoutingTableID: &routingTableID, Destination: &destination, Zone: zoneIdentityModel, - NextHop: &vpcv1.RouteNextHopPrototypeRouteNextHopIP{ + NextHop: &vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ Address: &address, }, } @@ -4381,7 +4386,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { } // end-get_backup_policy_plan - + ifMatchBackupPolicy = response.GetHeaders()["Etag"][0] Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) Expect(backupPolicyPlan).ToNot(BeNil()) @@ -4402,7 +4407,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { backupPolicyPlanID, backupPolicyPlanPatchModelAsPatch, ) - updateBackupPolicyPlanOptions.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyPlanOptions.SetIfMatch(ifMatchBackupPolicy) backupPolicyPlan, response, err := vpcService.UpdateBackupPolicyPlan(updateBackupPolicyPlanOptions) if err != nil { @@ -4450,7 +4455,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { backupPolicyID, backupPolicyPatchModelAsPatch, ) - updateBackupPolicyOptions.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateBackupPolicyOptions.SetIfMatch(ifMatchBackupPolicy) backupPolicy, response, err := vpcService.UpdateBackupPolicy(updateBackupPolicyOptions) if err != nil { @@ -4570,6 +4575,291 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) + }) + It(`ListVPNServers request example`, func() { + fmt.Println("\nListVPNServers() result:") + // begin-list_vpn_servers + + listVPNServersOptions := vpcService.NewListVPNServersOptions() + listVPNServersOptions.SetSort("name") + + vpnServerCollection, response, err := vpcService.ListVPNServers(listVPNServersOptions) + if err != nil { + panic(err) + } + + // end-list_vpn_servers + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServerCollection).ToNot(BeNil()) + + }) + It(`CreateVPNServer request example`, func() { + fmt.Println("\nCreateVPNServer() result:") + // begin-create_vpn_server + + certificateInstanceIdentityModel := &vpcv1.CertificateInstanceIdentityByCRN{ + CRN: core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"), + } + + vpnServerAuthenticationByUsernameIDProviderModel := &vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam{ + ProviderType: core.StringPtr("iam"), + } + + vpnServerAuthenticationPrototypeModel := &vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ + Method: core.StringPtr("certificate"), + IdentityProvider: vpnServerAuthenticationByUsernameIDProviderModel, + } + + subnetIdentityModel := &vpcv1.SubnetIdentityByID{ + ID: core.StringPtr(subnetID), + } + + createVPNServerOptions := vpcService.NewCreateVPNServerOptions( + certificateInstanceIdentityModel, + []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel}, + "172.16.0.0/16", + []vpcv1.SubnetIdentityIntf{subnetIdentityModel}, + ) + createVPNServerOptions.SetName("my-vpn-server") + + vpnServer, response, err := vpcService.CreateVPNServer(createVPNServerOptions) + if err != nil { + panic(err) + } + + // end-create_vpn_server + vpnServerID = *vpnServer.ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(vpnServer).ToNot(BeNil()) + + }) + It(`GetVPNServer request example`, func() { + fmt.Println("\nGetVPNServer() result:") + // begin-get_vpn_server + + getVPNServerOptions := vpcService.NewGetVPNServerOptions( + vpnServerID, + ) + + vpnServer, response, err := vpcService.GetVPNServer(getVPNServerOptions) + if err != nil { + panic(err) + } + + // end-get_vpn_server + ifMatchVPNServer = response.GetHeaders()["Etag"][0] + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServer).ToNot(BeNil()) + + }) + It(`UpdateVPNServer request example`, func() { + fmt.Println("\nUpdateVPNServer() result:") + // begin-update_vpn_server + + vpnServerPatchModel := &vpcv1.VPNServerPatch{ + Name: &[]string{"my-vpn-server-modified"}[0], + } + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateVPNServerOptions := vpcService.NewUpdateVPNServerOptions( + vpnServerID, + vpnServerPatchModelAsPatch, + ) + updateVPNServerOptions.SetIfMatch(ifMatchVPNServer) + + vpnServer, response, err := vpcService.UpdateVPNServer(updateVPNServerOptions) + if err != nil { + panic(err) + } + + // end-update_vpn_server + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServer).ToNot(BeNil()) + + }) + It(`GetVPNServerClientConfiguration request example`, func() { + fmt.Println("\nGetVPNServerClientConfiguration() result:") + // begin-get_vpn_server_client_configuration + + getVPNServerClientConfigurationOptions := vpcService.NewGetVPNServerClientConfigurationOptions( + vpnServerID, + ) + + vpnServerClientConfiguration, response, err := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions) + if err != nil { + panic(err) + } + + // end-get_vpn_server_client_configuration + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServerClientConfiguration).ToNot(BeNil()) + + }) + It(`ListVPNServerClients request example`, func() { + fmt.Println("\nListVPNServerClients() result:") + // begin-list_vpn_server_clients + + listVPNServerClientsOptions := vpcService.NewListVPNServerClientsOptions( + vpnServerID, + ) + listVPNServerClientsOptions.SetSort("created_at") + + vpnServerClientCollection, response, err := vpcService.ListVPNServerClients(listVPNServerClientsOptions) + if err != nil { + panic(err) + } + + // end-list_vpn_server_clients + vpnClientID = *vpnServerClientCollection.Clients[0].ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServerClientCollection).ToNot(BeNil()) + + }) + It(`GetVPNServerClient request example`, func() { + fmt.Println("\nGetVPNServerClient() result:") + // begin-get_vpn_server_client + + getVPNServerClientOptions := vpcService.NewGetVPNServerClientOptions( + vpnServerID, + vpnClientID, + ) + + vpnServerClient, response, err := vpcService.GetVPNServerClient(getVPNServerClientOptions) + if err != nil { + panic(err) + } + + // end-get_vpn_server_client + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServerClient).ToNot(BeNil()) + + }) + It(`DisconnectVPNClient request example`, func() { + // begin-disconnect_vpn_client + + disconnectVPNClientOptions := vpcService.NewDisconnectVPNClientOptions( + vpnServerID, + vpnClientID, + ) + + response, err := vpcService.DisconnectVPNClient(disconnectVPNClientOptions) + if err != nil { + panic(err) + } + if response.StatusCode != 202 { + fmt.Printf("\nUnexpected response status code received from DisconnectVPNClient(): %d\n", response.StatusCode) + } + + // end-disconnect_vpn_client + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + + }) + It(`ListVPNServerRoutes request example`, func() { + fmt.Println("\nListVPNServerRoutes() result:") + // begin-list_vpn_server_routes + + listVPNServerRoutesOptions := vpcService.NewListVPNServerRoutesOptions( + vpnServerID, + ) + listVPNServerRoutesOptions.SetSort("name") + + vpnServerRouteCollection, response, err := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptions) + if err != nil { + panic(err) + } + + // end-list_vpn_server_routes + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServerRouteCollection).ToNot(BeNil()) + + }) + It(`CreateVPNServerRoute request example`, func() { + fmt.Println("\nCreateVPNServerRoute() result:") + // begin-create_vpn_server_route + + createVPNServerRouteOptions := vpcService.NewCreateVPNServerRouteOptions( + vpnServerID, + "172.16.0.0/16", + ) + createVPNServerRouteOptions.SetName("my-vpn-server-route") + + vpnServerRoute, response, err := vpcService.CreateVPNServerRoute(createVPNServerRouteOptions) + if err != nil { + panic(err) + } + + // end-create_vpn_server_route + vpnServerRouteID = *vpnServerRoute.ID + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(vpnServerRoute).ToNot(BeNil()) + + }) + It(`GetVPNServerRoute request example`, func() { + fmt.Println("\nGetVPNServerRoute() result:") + // begin-get_vpn_server_route + + getVPNServerRouteOptions := vpcService.NewGetVPNServerRouteOptions( + vpnServerID, + vpnServerRouteID, + ) + + vpnServerRoute, response, err := vpcService.GetVPNServerRoute(getVPNServerRouteOptions) + if err != nil { + panic(err) + } + + // end-get_vpn_server_route + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServerRoute).ToNot(BeNil()) + + }) + It(`UpdateVPNServerRoute request example`, func() { + fmt.Println("\nUpdateVPNServerRoute() result:") + // begin-update_vpn_server_route + + vpnServerRoutePatchModel := &vpcv1.VPNServerRoutePatch{ + Name: &[]string{"my-vpn-server-route-modified"}[0], + } + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateVPNServerRouteOptions := vpcService.NewUpdateVPNServerRouteOptions( + vpnServerID, + vpnServerRouteID, + vpnServerRoutePatchModelAsPatch, + ) + + vpnServerRoute, response, err := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptions) + if err != nil { + panic(err) + } + + // end-update_vpn_server_route + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(vpnServerRoute).ToNot(BeNil()) + }) It(`ListLoadBalancerProfiles request example`, func() { fmt.Println("\nListLoadBalancerProfiles() result:") @@ -6244,6 +6534,73 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { Expect(response.StatusCode).To(Equal(204)) }) + It(`DeleteVPNServerRoute request example`, func() { + // begin-delete_vpn_server_route + + deleteVPNServerRouteOptions := vpcService.NewDeleteVPNServerRouteOptions( + vpnServerID, + vpnServerRouteID, + ) + + response, err := vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptions) + if err != nil { + panic(err) + } + if response.StatusCode != 202 { + fmt.Printf("\nUnexpected response status code received from DeleteVPNServerRoute(): %d\n", response.StatusCode) + } + + // end-delete_vpn_server_route + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + + }) + It(`DeleteVPNServerClient request example`, func() { + // begin-delete_vpn_server_client + + deleteVPNServerClientOptions := vpcService.NewDeleteVPNServerClientOptions( + vpnServerID, + vpnClientID, + ) + + response, err := vpcService.DeleteVPNServerClient(deleteVPNServerClientOptions) + if err != nil { + panic(err) + } + if response.StatusCode != 202 { + fmt.Printf("\nUnexpected response status code received from DeleteVPNServerClient(): %d\n", response.StatusCode) + } + + // end-delete_vpn_server_client + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + + }) + It(`DeleteVPNServer request example`, func() { + // begin-delete_vpn_server + + deleteVPNServerOptions := vpcService.NewDeleteVPNServerOptions( + vpnServerID, + ) + deleteVPNServerOptions.SetIfMatch(ifMatchVPNServer) + + response, err := vpcService.DeleteVPNServer(deleteVPNServerOptions) + if err != nil { + panic(err) + } + if response.StatusCode != 202 { + fmt.Printf("\nUnexpected response status code received from DeleteVPNServer(): %d\n", response.StatusCode) + } + + // end-delete_vpn_server + + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + + }) + It(`DeleteVPNGatewayConnection request example`, func() { // begin-delete_vpn_gateway_connection @@ -6287,7 +6644,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { backupPolicyID, backupPolicyPlanID, ) - deleteBackupPolicyPlanOptions.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyPlanOptions.SetIfMatch(ifMatchBackupPolicy) backupPolicyPlan, response, err := vpcService.DeleteBackupPolicyPlan(deleteBackupPolicyPlanOptions) if err != nil { @@ -6308,7 +6665,7 @@ var _ = Describe(`VpcV1 Examples Tests`, func() { deleteBackupPolicyOptions := vpcService.NewDeleteBackupPolicyOptions( backupPolicyID, ) - deleteBackupPolicyOptions.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteBackupPolicyOptions.SetIfMatch(ifMatchBackupPolicy) backupPolicy, response, err := vpcService.DeleteBackupPolicy(deleteBackupPolicyOptions) if err != nil { diff --git a/vpcv1/vpc_v1_integration_test.go b/vpcv1/vpc_v1_integration_test.go index e92980f..f340073 100644 --- a/vpcv1/vpc_v1_integration_test.go +++ b/vpcv1/vpc_v1_integration_test.go @@ -93,6 +93,9 @@ var ( lbProfile *string backupPolicyID *string backupPolicyPlanID *string + vpnClientID *string + vpnServerRouteID *string + vpnServerID *string detailed = flag.Bool("detailed", false, "boolean") Running = "running" skipForMockTesting = flag.Bool("skipForMockTesting", false, "boolean") @@ -1992,6 +1995,96 @@ func TestBackupPolicies(t *testing.T) { }) } + +func TestVPNServers(t *testing.T) { + vpcService := createVpcService(t) + var ifMatchVPNServer string + t.Run("VPN Servers", func(t *testing.T) { + t.Run("Create a VPN server", func(t *testing.T) { + name := "my-vpn-server" + crn := "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5" + providerType := "iam" + method := "certificate" + clientIPPool := "172.16.0.0/16" + res, httpres, err := CreateVPNServer(vpcService, *createdSubnetID, crn, providerType, method, name, clientIPPool) + ValidateResponse(t, res, err, POST, detailed, increment) + vpnClientID = res.ID + ifMatchVPNServer = httpres.GetHeaders()["Etag"][0] + }) + + t.Run("List all vpn servers", func(t *testing.T) { + res, _, err := ListVPNServers(vpcService) + ValidateListResponse(t, res, err, GET, detailed, increment) + }) + t.Run("List all VPN clients for a VPN server", func(t *testing.T) { + res, _, err := ListVPNServerClients(vpcService, *vpnServerID) + ValidateListResponse(t, res, err, GET, detailed, increment) + vpnClientID = res.Clients[0].ID + }) + + t.Run("Create a VPN route for a VPN server", func(t *testing.T) { + name := "my-vpn-route" + destination := "172.16.0.0/16" + res, _, err := CreateVPNServerRoute(vpcService, *vpnServerID, destination, name) + ValidateResponse(t, res, err, POST, detailed, increment) + vpnServerRouteID = res.ID + }) + t.Run("List all VPN routes for a VPN server", func(t *testing.T) { + res, _, err := ListVPNServerRoutes(vpcService, *vpnServerID) + ValidateListResponse(t, res, err, GET, detailed, increment) + }) + t.Run("Get client configuration", func(t *testing.T) { + res, _, err := GetVPNServerClientConfiguration(vpcService, *vpnServerID) + ValidateResponse(t, res, err, GET, detailed, increment) + }) + + t.Run("Get a VPN client", func(t *testing.T) { + res, _, err := GetVPNServerClient(vpcService, *vpnServerID, *vpnClientID) + ValidateResponse(t, res, err, GET, detailed, increment) + }) + t.Run("Get a VPN route", func(t *testing.T) { + res, _, err := GetVPNServerRoute(vpcService, *vpnServerID, *vpnServerRouteID) + ValidateResponse(t, res, err, GET, detailed, increment) + }) + t.Run("Get a VPN server", func(t *testing.T) { + res, _, err := GetVPNServer(vpcService, *vpnServerID) + ValidateResponse(t, res, err, GET, detailed, increment) + }) + + t.Run("Update a VPN route", func(t *testing.T) { + name := "my-vpn-route-modified" + res, _, err := UpdateVPNServerRoute(vpcService, *vpnServerID, *vpnServerRouteID, name, ifMatchVPNServer) + ValidateResponse(t, res, err, PATCH, detailed, increment) + + }) + + t.Run("Update a VPN server", func(t *testing.T) { + name := "my-vpn-server-modified" + res, _, err := UpdateVPNServer(vpcService, *vpnServerID, name, ifMatchVPNServer) + ValidateResponse(t, res, err, PATCH, detailed, increment) + + }) + + t.Run("Disconnect a VPN client", func(t *testing.T) { + res, err := DisconnectVPNClient(vpcService, *vpnServerID, *vpnClientID) + ValidateResponse(t, res, err, POST, detailed, increment) + }) + t.Run("Delete a VPN route", func(t *testing.T) { + res, err := DeleteVPNServerRoute(vpcService, *vpnServerID, *vpnServerRouteID) + ValidateDeleteResponse(t, res, err, DELETE, res.StatusCode, detailed, increment) + }) + + t.Run("Delete a VPN client", func(t *testing.T) { + res, err := DeleteVPNServerClient(vpcService, *vpnServerID, *vpnClientID) + ValidateDeleteResponse(t, res, err, DELETE, res.StatusCode, detailed, increment) + }) + t.Run("Delete a VPN server", func(t *testing.T) { + res, err := DeleteVPNServer(vpcService, *vpnServerID, ifMatchVPNServer) + ValidateDeleteResponse(t, res, err, DELETE, res.StatusCode, detailed, increment) + }) + + }) +} func TestVPCTeardown(t *testing.T) { vpcService := createVpcService(t) shouldSkipTest(t) diff --git a/vpcv1/vpc_v1_integration_utils_test.go b/vpcv1/vpc_v1_integration_utils_test.go index 18aeb57..46334be 100644 --- a/vpcv1/vpc_v1_integration_utils_test.go +++ b/vpcv1/vpc_v1_integration_utils_test.go @@ -414,7 +414,7 @@ func CreateVpcRoute(vpcService *vpcv1.VpcV1, vpcID, zone, destination, nextHopAd options.SetZone(&vpcv1.ZoneIdentity{ Name: &zone, }) - options.SetNextHop(&vpcv1.RouteNextHopPrototype{ + options.SetNextHop(&vpcv1.RoutePrototypeNextHop{ Address: &nextHopAddress, }) options.SetDestination(destination) @@ -2994,7 +2994,7 @@ func ListVPCRoutingTables(vpcService *vpcv1.VpcV1, vpcId string) (routingTableCo // /vpcs/{vpc_id}/routing_tables // Create a VPC routing table func CreateVPCRoutingTable(vpcService *vpcv1.VpcV1, vpcId, name, zoneName string) (routingTable *vpcv1.RoutingTable, response *core.DetailedResponse, err error) { - routeNextHopPrototypeModel := &vpcv1.RouteNextHopPrototypeRouteNextHopIP{ + routeNextHopPrototypeModel := &vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ Address: core.StringPtr("192.168.3.4"), } @@ -3073,7 +3073,7 @@ func ListVPCRoutingTableRoutes(vpcService *vpcv1.VpcV1, vpcId, routingTableID st // /vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes // Create a VPC route func CreateVPCRoutingTableRoute(vpcService *vpcv1.VpcV1, vpcId, routingTableId, zone string) (route *vpcv1.Route, response *core.DetailedResponse, err error) { - routeNextHopPrototypeModel := &vpcv1.RouteNextHopPrototypeRouteNextHopIP{ + routeNextHopPrototypeModel := &vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP{ Address: core.StringPtr("192.168.3.4"), } @@ -3661,3 +3661,176 @@ func UpdateBackupPolicy(vpcService *vpcv1.VpcV1, backupPolicyID, name, ifMatch s backupPolicy, response, err = vpcService.UpdateBackupPolicy(updateBackupPolicyOptions) return } + +// VPN servers + +func ListVPNServers(vpcService *vpcv1.VpcV1) (vpnServerCollection *vpcv1.VPNServerCollection, response *core.DetailedResponse, err error) { + listVPNServersOptions := vpcService.NewListVPNServersOptions() + vpnServerCollection, response, err = vpcService.ListVPNServers(listVPNServersOptions) + return +} +func ListVPNServerClients(vpcService *vpcv1.VpcV1, vpnServerID string) (vpnServerClientCollection *vpcv1.VPNServerClientCollection, response *core.DetailedResponse, err error) { + listVPNServerClientsOptions := vpcService.NewListVPNServerClientsOptions( + vpnServerID, + ) + vpnServerClientCollection, response, err = vpcService.ListVPNServerClients(listVPNServerClientsOptions) + return +} +func ListVPNServerRoutes(vpcService *vpcv1.VpcV1, vpnServerID string) (vpnServerRouteCollection *vpcv1.VPNServerRouteCollection, response *core.DetailedResponse, err error) { + listVPNServerRoutesOptions := vpcService.NewListVPNServerRoutesOptions( + vpnServerID, + ) + vpnServerRouteCollection, response, err = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptions) + return +} + +func CreateVPNServer(vpcService *vpcv1.VpcV1, subnetID, crn, providerType, method, name, clientIPPool string) (vpnServer *vpcv1.VPNServer, response *core.DetailedResponse, err error) { + + certificateInstanceIdentityModel := &vpcv1.CertificateInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + + vpnServerAuthenticationByUsernameIDProviderModel := &vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam{ + ProviderType: core.StringPtr(providerType), + } + + vpnServerAuthenticationPrototypeModel := &vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype{ + Method: core.StringPtr(method), + IdentityProvider: vpnServerAuthenticationByUsernameIDProviderModel, + } + + subnetIdentityModel := &vpcv1.SubnetIdentityByID{ + ID: core.StringPtr(subnetID), + } + + options := vpcService.NewCreateVPNServerOptions( + certificateInstanceIdentityModel, + []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel}, + clientIPPool, + []vpcv1.SubnetIdentityIntf{subnetIdentityModel}, + ) + options.SetName(name) + + vpnServer, response, err = vpcService.CreateVPNServer(options) + return +} + +func DisconnectVPNClient(vpcService *vpcv1.VpcV1, vpnServerID, vpnClientID string) (response *core.DetailedResponse, err error) { + disconnectVPNClientOptions := vpcService.NewDisconnectVPNClientOptions( + vpnServerID, + vpnClientID, + ) + + response, err = vpcService.DisconnectVPNClient(disconnectVPNClientOptions) + return +} +func CreateVPNServerRoute(vpcService *vpcv1.VpcV1, vpnServerID, destination, name string) (vpnServerRoute *vpcv1.VPNServerRoute, response *core.DetailedResponse, err error) { + createVPNServerRouteOptions := vpcService.NewCreateVPNServerRouteOptions( + vpnServerID, + destination, + ) + createVPNServerRouteOptions.SetName(name) + + vpnServerRoute, response, err = vpcService.CreateVPNServerRoute(createVPNServerRouteOptions) + return +} + +func DeleteVPNServerClient(vpcService *vpcv1.VpcV1, vpnServerID, vpnClientID string) (response *core.DetailedResponse, err error) { + deleteVPNServerClientOptions := vpcService.NewDeleteVPNServerClientOptions( + vpnServerID, + vpnClientID, + ) + + response, err = vpcService.DeleteVPNServerClient(deleteVPNServerClientOptions) + return response, err +} + +func DeleteVPNServerRoute(vpcService *vpcv1.VpcV1, vpnServerID, vpnServerRouteID string) (response *core.DetailedResponse, err error) { + deleteVPNServerRouteOptions := vpcService.NewDeleteVPNServerRouteOptions( + vpnServerID, + vpnServerRouteID, + ) + + response, err = vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptions) + return response, err +} +func DeleteVPNServer(vpcService *vpcv1.VpcV1, vpnServerID, ifMatchVPNServer string) (response *core.DetailedResponse, err error) { + deleteVPNServerOptions := vpcService.NewDeleteVPNServerOptions( + vpnServerID, + ) + deleteVPNServerOptions.SetIfMatch(ifMatchVPNServer) + + response, err = vpcService.DeleteVPNServer(deleteVPNServerOptions) + return response, err +} + +func GetVPNServer(vpcService *vpcv1.VpcV1, vpnServerID string) (vpnServer *vpcv1.VPNServer, response *core.DetailedResponse, err error) { + getVPNServerOptions := vpcService.NewGetVPNServerOptions( + vpnServerID, + ) + + vpnServer, response, err = vpcService.GetVPNServer(getVPNServerOptions) + return +} +func GetVPNServerClient(vpcService *vpcv1.VpcV1, vpnServerID, vpnClientID string) (vpnServerClient *vpcv1.VPNServerClient, response *core.DetailedResponse, err error) { + getVPNServerClientOptions := vpcService.NewGetVPNServerClientOptions( + vpnServerID, + vpnClientID, + ) + + vpnServerClient, response, err = vpcService.GetVPNServerClient(getVPNServerClientOptions) + return +} +func GetVPNServerRoute(vpcService *vpcv1.VpcV1, vpnServerID, vpnServerRouteID string) (vpnServerRoute *vpcv1.VPNServerRoute, response *core.DetailedResponse, err error) { + getVPNServerRouteOptions := vpcService.NewGetVPNServerRouteOptions( + vpnServerID, + vpnServerRouteID, + ) + + vpnServerRoute, response, err = vpcService.GetVPNServerRoute(getVPNServerRouteOptions) + return +} +func GetVPNServerClientConfiguration(vpcService *vpcv1.VpcV1, vpnServerID string) (vpnServerClientConfiguration *string, response *core.DetailedResponse, err error) { + getVPNServerClientConfigurationOptions := vpcService.NewGetVPNServerClientConfigurationOptions( + vpnServerID, + ) + + vpnServerClientConfiguration, response, err = vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions) + return +} + +func UpdateVPNServerRoute(vpcService *vpcv1.VpcV1, vpnServerID, vpnServerRouteID, name, ifMatch string) (vpnServerRoute *vpcv1.VPNServerRoute, response *core.DetailedResponse, err error) { + vpnServerRoutePatchModel := &vpcv1.VPNServerRoutePatch{ + Name: &[]string{name}[0], + } + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + if asPatchErr != nil { + panic(asPatchErr) + } + + updateVPNServerRouteOptions := vpcService.NewUpdateVPNServerRouteOptions( + vpnServerID, + vpnServerRouteID, + vpnServerRoutePatchModelAsPatch, + ) + + vpnServerRoute, response, err = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptions) + return +} +func UpdateVPNServer(vpcService *vpcv1.VpcV1, vpnServerID, name, ifMatchVPNServer string) (vpnServer *vpcv1.VPNServer, response *core.DetailedResponse, err error) { + vpnServerPatchModel := &vpcv1.VPNServerPatch{ + Name: &[]string{name}[0], + } + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + if asPatchErr != nil { + panic(asPatchErr) + } + updateVPNServerOptions := vpcService.NewUpdateVPNServerOptions( + vpnServerID, + vpnServerPatchModelAsPatch, + ) + updateVPNServerOptions.SetIfMatch(ifMatchVPNServer) + + vpnServer, response, err = vpcService.UpdateVPNServer(updateVPNServerOptions) + return +} diff --git a/vpcv1/vpc_v1_test.go b/vpcv1/vpc_v1_test.go index 9363e82..19b1e8f 100644 --- a/vpcv1/vpc_v1_test.go +++ b/vpcv1/vpc_v1_test.go @@ -1397,7 +1397,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-malaise", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetVPCDefaultNetworkACL successfully with retries`, func() { @@ -1454,7 +1454,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-malaise", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::network-acl:a4e28308-8ee7-46ab-8108-9f881f22bdbf", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf", "id": "a4e28308-8ee7-46ab-8108-9f881f22bdbf", "name": "mnemonic-ersatz-eatery-mythology", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "rules": [{"action": "allow", "before": {"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "name": "my-rule-1"}, "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "direction": "inbound", "href": "https://us-south.iaas.cloud.ibm.com/v1/network_acls/a4e28308-8ee7-46ab-8108-9f881f22bdbf/rules/8daca77a-4980-4d33-8f3e-7038797be8f9", "id": "8daca77a-4980-4d33-8f3e-7038797be8f9", "ip_version": "ipv4", "name": "my-rule-2", "source": "192.168.3.0/24", "destination_port_max": 22, "destination_port_min": 22, "protocol": "udp", "source_port_max": 65535, "source_port_min": 49152}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) })) }) It(`Invoke GetVPCDefaultNetworkACL successfully`, func() { @@ -1622,7 +1622,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCDefaultRoutingTable successfully with retries`, func() { @@ -1679,7 +1679,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "milled-easy-equine-machines", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCDefaultRoutingTable successfully`, func() { @@ -3255,7 +3255,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutes successfully with retries`, func() { @@ -3318,7 +3318,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutes successfully`, func() { @@ -3486,9 +3486,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRouteOptions model createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) @@ -3496,8 +3496,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := vpcService.CreateVPCRoute(createVPCRouteOptionsModel) @@ -3553,7 +3553,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateVPCRoute successfully with retries`, func() { @@ -3570,9 +3570,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRouteOptions model createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) @@ -3580,8 +3580,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -3639,7 +3639,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateVPCRoute successfully`, func() { @@ -3661,9 +3661,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRouteOptions model createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) @@ -3671,8 +3671,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -3695,9 +3695,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRouteOptions model createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) @@ -3705,8 +3705,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -3750,9 +3750,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRouteOptions model createVPCRouteOptionsModel := new(vpcv1.CreateVPCRouteOptions) @@ -3760,8 +3760,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRouteOptionsModel.Zone = zoneIdentityModel createVPCRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -3922,7 +3922,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetVPCRoute successfully with retries`, func() { @@ -3980,7 +3980,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetVPCRoute successfully`, func() { @@ -4175,7 +4175,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateVPCRoute successfully with retries`, func() { @@ -4256,7 +4256,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateVPCRoute successfully`, func() { @@ -4457,7 +4457,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTables successfully with retries`, func() { @@ -4520,7 +4520,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=20"}, "routing_tables": [{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTables successfully`, func() { @@ -4684,9 +4684,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) @@ -4696,13 +4700,14 @@ var _ = Describe(`VpcV1`, func() { routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-2") - routePrototypeModel.NextHop = routeNextHopPrototypeModel + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel routePrototypeModel.Zone = zoneIdentityModel // Construct an instance of the CreateVPCRoutingTableOptions model createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -4763,7 +4768,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke CreateVPCRoutingTable successfully with retries`, func() { @@ -4776,9 +4781,13 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) @@ -4788,13 +4797,14 @@ var _ = Describe(`VpcV1`, func() { routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-2") - routePrototypeModel.NextHop = routeNextHopPrototypeModel + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel routePrototypeModel.Zone = zoneIdentityModel // Construct an instance of the CreateVPCRoutingTableOptions model createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -4857,7 +4867,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke CreateVPCRoutingTable successfully`, func() { @@ -4875,9 +4885,13 @@ var _ = Describe(`VpcV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) @@ -4887,13 +4901,14 @@ var _ = Describe(`VpcV1`, func() { routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-2") - routePrototypeModel.NextHop = routeNextHopPrototypeModel + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel routePrototypeModel.Zone = zoneIdentityModel // Construct an instance of the CreateVPCRoutingTableOptions model createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -4917,9 +4932,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) @@ -4929,13 +4948,14 @@ var _ = Describe(`VpcV1`, func() { routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-2") - routePrototypeModel.NextHop = routeNextHopPrototypeModel + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel routePrototypeModel.Zone = zoneIdentityModel // Construct an instance of the CreateVPCRoutingTableOptions model createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -4980,9 +5000,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) @@ -4992,13 +5016,14 @@ var _ = Describe(`VpcV1`, func() { routePrototypeModel := new(vpcv1.RoutePrototype) routePrototypeModel.Action = core.StringPtr("deliver") routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-2") - routePrototypeModel.NextHop = routeNextHopPrototypeModel + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel routePrototypeModel.Zone = zoneIdentityModel // Construct an instance of the CreateVPCRoutingTableOptions model createVPCRoutingTableOptionsModel := new(vpcv1.CreateVPCRoutingTableOptions) createVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") + createVPCRoutingTableOptionsModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} createVPCRoutingTableOptionsModel.Name = core.StringPtr("my-routing-table-2") createVPCRoutingTableOptionsModel.RouteDirectLinkIngress = core.BoolPtr(false) createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress = core.BoolPtr(false) @@ -5031,6 +5056,8 @@ var _ = Describe(`VpcV1`, func() { Expect(req.URL.EscapedPath()).To(Equal(deleteVPCRoutingTablePath)) Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.WriteHeader(204) @@ -5054,6 +5081,7 @@ var _ = Describe(`VpcV1`, func() { deleteVPCRoutingTableOptionsModel := new(vpcv1.DeleteVPCRoutingTableOptions) deleteVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") deleteVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + deleteVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) deleteVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -5074,6 +5102,7 @@ var _ = Describe(`VpcV1`, func() { deleteVPCRoutingTableOptionsModel := new(vpcv1.DeleteVPCRoutingTableOptions) deleteVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") deleteVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") + deleteVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) deleteVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -5164,7 +5193,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCRoutingTable successfully with retries`, func() { @@ -5222,7 +5251,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetVPCRoutingTable successfully`, func() { @@ -5335,6 +5364,8 @@ var _ = Describe(`VpcV1`, func() { // Verify the contents of the request Expect(req.URL.EscapedPath()).To(Equal(updateVPCRoutingTablePath)) Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) res.Header().Set("Content-type", "application/json") @@ -5351,8 +5382,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) @@ -5365,6 +5401,7 @@ var _ = Describe(`VpcV1`, func() { updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := vpcService.UpdateVPCRoutingTable(updateVPCRoutingTableOptionsModel) @@ -5412,6 +5449,8 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Sleep a short time to support a timeout test @@ -5420,7 +5459,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke UpdateVPCRoutingTable successfully with retries`, func() { @@ -5433,8 +5472,13 @@ var _ = Describe(`VpcV1`, func() { Expect(vpcService).ToNot(BeNil()) vpcService.EnableRetries(0, 0) + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) @@ -5447,6 +5491,7 @@ var _ = Describe(`VpcV1`, func() { updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -5499,12 +5544,14 @@ var _ = Describe(`VpcV1`, func() { } fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke UpdateVPCRoutingTable successfully`, func() { @@ -5522,8 +5569,13 @@ var _ = Describe(`VpcV1`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) @@ -5536,6 +5588,7 @@ var _ = Describe(`VpcV1`, func() { updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -5554,8 +5607,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) @@ -5568,6 +5626,7 @@ var _ = Describe(`VpcV1`, func() { updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -5607,8 +5666,13 @@ var _ = Describe(`VpcV1`, func() { Expect(serviceErr).To(BeNil()) Expect(vpcService).ToNot(BeNil()) + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + // Construct an instance of the RoutingTablePatch model routingTablePatchModel := new(vpcv1.RoutingTablePatch) + routingTablePatchModel.AcceptRoutesFrom = []vpcv1.ResourceFilter{*resourceFilterModel} routingTablePatchModel.Name = core.StringPtr("my-routing-table-2") routingTablePatchModel.RouteDirectLinkIngress = core.BoolPtr(true) routingTablePatchModel.RouteTransitGatewayIngress = core.BoolPtr(true) @@ -5621,6 +5685,7 @@ var _ = Describe(`VpcV1`, func() { updateVPCRoutingTableOptionsModel.VPCID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.ID = core.StringPtr("testString") updateVPCRoutingTableOptionsModel.RoutingTablePatch = routingTablePatchModelAsPatch + updateVPCRoutingTableOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPCRoutingTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -5712,7 +5777,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTableRoutes successfully with retries`, func() { @@ -5774,7 +5839,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/1a15dca5-7e33-45e1-b7c5-bc690e569531/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}], "total_count": 132}`) })) }) It(`Invoke ListVPCRoutingTableRoutes successfully`, func() { @@ -5942,9 +6007,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRoutingTableRouteOptions model createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) @@ -5953,8 +6018,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRoutingTableRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response result, response, operationErr := vpcService.CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptionsModel) @@ -6010,7 +6075,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateVPCRoutingTableRoute successfully with retries`, func() { @@ -6027,9 +6092,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRoutingTableRouteOptions model createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) @@ -6038,8 +6103,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRoutingTableRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error @@ -6097,7 +6162,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke CreateVPCRoutingTableRoute successfully`, func() { @@ -6119,9 +6184,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRoutingTableRouteOptions model createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) @@ -6130,8 +6195,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRoutingTableRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) @@ -6154,9 +6219,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRoutingTableRouteOptions model createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) @@ -6165,8 +6230,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRoutingTableRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := vpcService.SetServiceURL("") @@ -6210,9 +6275,9 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel := new(vpcv1.ZoneIdentityByName) zoneIdentityModel.Name = core.StringPtr("us-south-1") - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") // Construct an instance of the CreateVPCRoutingTableRouteOptions model createVPCRoutingTableRouteOptionsModel := new(vpcv1.CreateVPCRoutingTableRouteOptions) @@ -6221,8 +6286,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.Destination = core.StringPtr("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.Zone = zoneIdentityModel createVPCRoutingTableRouteOptionsModel.Action = core.StringPtr("deliver") - createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-2") - createVPCRoutingTableRouteOptionsModel.NextHop = routeNextHopPrototypeModel + createVPCRoutingTableRouteOptionsModel.Name = core.StringPtr("my-route-1") + createVPCRoutingTableRouteOptionsModel.NextHop = routePrototypeNextHopModel createVPCRoutingTableRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation @@ -6386,7 +6451,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetVPCRoutingTableRoute successfully with retries`, func() { @@ -6445,7 +6510,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke GetVPCRoutingTableRoute successfully`, func() { @@ -6644,7 +6709,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateVPCRoutingTableRoute successfully with retries`, func() { @@ -6726,7 +6791,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) + fmt.Fprintf(res, "%s", `{"action": "delegate", "created_at": "2019-01-01T12:00:00.000Z", "creator": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn:ddf51bec-3424-11e8-b467-0ed5f89f718b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b", "id": "ddf51bec-3424-11e8-b467-0ed5f89f718b", "name": "my-vpn-gateway", "resource_type": "vpn_gateway"}, "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-route-1", "next_hop": {"address": "192.168.3.4"}, "origin": "service", "zone": {"href": "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1", "name": "us-south-1"}}`) })) }) It(`Invoke UpdateVPCRoutingTableRoute successfully`, func() { @@ -9392,7 +9457,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetSubnetRoutingTable successfully with retries`, func() { @@ -9449,7 +9514,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke GetSubnetRoutingTable successfully`, func() { @@ -9638,7 +9703,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke ReplaceSubnetRoutingTable successfully with retries`, func() { @@ -9716,7 +9781,7 @@ var _ = Describe(`VpcV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) + fmt.Fprintf(res, "%s", `{"accept_routes_from": [{"resource_type": "vpn_gateway"}], "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routing_tables/6885e83f-03b2-4603-8a86-db2a0f55c840", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "is_default": false, "lifecycle_state": "stable", "name": "my-routing-table-1", "resource_type": "routing_table", "route_direct_link_ingress": true, "route_transit_gateway_ingress": true, "route_vpc_zone_ingress": false, "routes": [{"deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "name": "my-route-1"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}]}`) })) }) It(`Invoke ReplaceSubnetRoutingTable successfully`, func() { @@ -41126,471 +41191,6 @@ var _ = Describe(`VpcV1`, func() { }) }) }) - Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions) - Operation response error`, func() { - version := "testString" - listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptions *ListBareMetalServerNetworkInterfaceIpsOptions)`, func() { - version := "testString" - listBareMetalServerNetworkInterfaceIpsPath := "/bare_metal_servers/testString/network_interfaces/testString/ips" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) - })) - }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully with retries`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIpsWithContext(ctx, listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBareMetalServerNetworkInterfaceIpsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?limit=20"}, "ips": [{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}], "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/instances/1e09281b-f177-46fb-baf1-bc152b2e391a/network_interfaces/10c02d81-0ecb-4dc5-897d-28392913b81e/ips?start=a404e343444b4e1095c9edba76672d67&limit=20"}, "total_count": 132}`) - })) - }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the ListBareMetalServerNetworkInterfaceIpsOptions model with no property values - listBareMetalServerNetworkInterfaceIpsOptionsModelNew := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke ListBareMetalServerNetworkInterfaceIps successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - listBareMetalServerNetworkInterfaceIpsOptionsModel := new(vpcv1.ListBareMetalServerNetworkInterfaceIpsOptions) - listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.ListBareMetalServerNetworkInterfaceIps(listBareMetalServerNetworkInterfaceIpsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions) - Operation response error`, func() { - version := "testString" - getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation response processing error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - vpcService.EnableRetries(0, 0) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptions *GetBareMetalServerNetworkInterfaceIPOptions)`, func() { - version := "testString" - getBareMetalServerNetworkInterfaceIPPath := "/bare_metal_servers/testString/network_interfaces/testString/ips/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully with retries`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - vpcService.EnableRetries(0, 0) - - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - vpcService.DisableRetries() - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIPWithContext(ctx, getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBareMetalServerNetworkInterfaceIPPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"address": "192.168.3.4", "auto_delete": false, "created_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "lifecycle_state": "stable", "name": "my-reserved-ip", "owner": "user", "resource_type": "subnet_reserved_ip", "target": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::endpoint-gateway:d7cc5196-9864-48c4-82d8-3f30da41fcc5", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/endpoint_gateways/d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "d7cc5196-9864-48c4-82d8-3f30da41fcc5", "name": "my-endpoint-gateway", "resource_type": "endpoint_gateway"}}`) - })) - }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP with error: Operation validation and request error`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := vpcService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the GetBareMetalServerNetworkInterfaceIPOptions model with no property values - getBareMetalServerNetworkInterfaceIPOptionsModelNew := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke GetBareMetalServerNetworkInterfaceIP successfully`, func() { - vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - Version: core.StringPtr(version), - }) - Expect(serviceErr).To(BeNil()) - Expect(vpcService).ToNot(BeNil()) - - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - getBareMetalServerNetworkInterfaceIPOptionsModel := new(vpcv1.GetBareMetalServerNetworkInterfaceIPOptions) - getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.ID = core.StringPtr("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := vpcService.GetBareMetalServerNetworkInterfaceIP(getBareMetalServerNetworkInterfaceIPOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) Describe(`DeleteBareMetalServer(deleteBareMetalServerOptions *DeleteBareMetalServerOptions)`, func() { version := "testString" deleteBareMetalServerPath := "/bare_metal_servers/testString" @@ -61096,6 +60696,3486 @@ var _ = Describe(`VpcV1`, func() { }) }) }) + Describe(`ListVPNServers(listVPNServersOptions *ListVPNServersOptions) - Operation response error`, func() { + version := "testString" + listVPNServersPath := "/vpn_servers" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServersPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPNServers with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServers(listVPNServersOptions *ListVPNServersOptions)`, func() { + version := "testString" + listVPNServersPath := "/vpn_servers" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) + })) + }) + It(`Invoke ListVPNServers successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListVPNServersWithContext(ctx, listVPNServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListVPNServersWithContext(ctx, listVPNServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServersPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["resource_group.id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers?start=ffd653466e284937896724b2dd044c9c&limit=20"}, "total_count": 132, "vpn_servers": [{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}]}`) + })) + }) + It(`Invoke ListVPNServers successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListVPNServers(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNServers with error: Operation request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListVPNServers successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := new(vpcv1.ListVPNServersOptions) + listVPNServersOptionsModel.Name = core.StringPtr("testString") + listVPNServersOptionsModel.Start = core.StringPtr("testString") + listVPNServersOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServersOptionsModel.ResourceGroupID = core.StringPtr("testString") + listVPNServersOptionsModel.Sort = core.StringPtr("name") + listVPNServersOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNServers(listVPNServersOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VPNServerCollection) + nextObject := new(vpcv1.VPNServerCollectionNext) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.VPNServerCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.VPNServerCollection) + nextObject := new(vpcv1.VPNServerCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions) - Operation response error`, func() { + version := "testString" + createVPNServerPath := "/vpn_servers" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createVPNServerPath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateVPNServer with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPNServer(createVPNServerOptions *CreateVPNServerOptions)`, func() { + version := "testString" + createVPNServerPath := "/vpn_servers" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createVPNServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateVPNServer successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.CreateVPNServerWithContext(ctx, createVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.CreateVPNServerWithContext(ctx, createVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createVPNServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke CreateVPNServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPNServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateVPNServerOptions model with no property values + createVPNServerOptionsModelNew := new(vpcv1.CreateVPNServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPNServer(createVPNServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateVPNServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + + // Construct an instance of the CreateVPNServerOptions model + createVPNServerOptionsModel := new(vpcv1.CreateVPNServerOptions) + createVPNServerOptionsModel.Certificate = certificateInstanceIdentityModel + createVPNServerOptionsModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + createVPNServerOptionsModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + createVPNServerOptionsModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + createVPNServerOptionsModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + createVPNServerOptionsModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + createVPNServerOptionsModel.EnableSplitTunneling = core.BoolPtr(false) + createVPNServerOptionsModel.Name = core.StringPtr("my-vpn-server") + createVPNServerOptionsModel.Port = core.Int64Ptr(int64(443)) + createVPNServerOptionsModel.Protocol = core.StringPtr("udp") + createVPNServerOptionsModel.ResourceGroup = resourceGroupIdentityModel + createVPNServerOptionsModel.SecurityGroups = []vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel} + createVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPNServer(createVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPNServer(deleteVPNServerOptions *DeleteVPNServerOptions)`, func() { + version := "testString" + deleteVPNServerPath := "/vpn_servers/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteVPNServerPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNServerOptions model + deleteVPNServerOptionsModel := new(vpcv1.DeleteVPNServerOptions) + deleteVPNServerOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNServer(deleteVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteVPNServerOptions model + deleteVPNServerOptionsModel := new(vpcv1.DeleteVPNServerOptions) + deleteVPNServerOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteVPNServer(deleteVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNServerOptions model with no property values + deleteVPNServerOptionsModelNew := new(vpcv1.DeleteVPNServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNServer(deleteVPNServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServer(getVPNServerOptions *GetVPNServerOptions) - Operation response error`, func() { + version := "testString" + getVPNServerPath := "/vpn_servers/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetVPNServer with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServer(getVPNServerOptions *GetVPNServerOptions)`, func() { + version := "testString" + getVPNServerPath := "/vpn_servers/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPNServer successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetVPNServerWithContext(ctx, getVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetVPNServerWithContext(ctx, getVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke GetVPNServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetVPNServerOptions model with no property values + getVPNServerOptionsModelNew := new(vpcv1.GetVPNServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServer(getVPNServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetVPNServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerOptions model + getVPNServerOptionsModel := new(vpcv1.GetVPNServerOptions) + getVPNServerOptionsModel.ID = core.StringPtr("testString") + getVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServer(getVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions) - Operation response error`, func() { + version := "testString" + updateVPNServerPath := "/vpn_servers/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateVPNServerPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateVPNServer with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServer(updateVPNServerOptions *UpdateVPNServerOptions)`, func() { + version := "testString" + updateVPNServerPath := "/vpn_servers/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateVPNServerPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateVPNServer successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.UpdateVPNServerWithContext(ctx, updateVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.UpdateVPNServerWithContext(ctx, updateVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateVPNServerPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["If-Match"]).ToNot(BeNil()) + Expect(req.Header["If-Match"][0]).To(Equal(fmt.Sprintf("%v", `W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"certificate": {"crn": "crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"}, "client_authentication": [{"method": "certificate", "identity_provider": {"provider_type": "iam"}}], "client_auto_delete": true, "client_auto_delete_timeout": 1, "client_dns_server_ips": [{"address": "192.168.3.4"}], "client_idle_timeout": 600, "client_ip_pool": "172.16.0.0/16", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpn-server:r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "enable_split_tunneling": true, "health_state": "ok", "hostname": "a8506291.us-south.vpn-server.appdomain.cloud", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "id": "r006-d7cc5196-9864-48c4-82d8-3f30da41fcc5", "lifecycle_state": "stable", "name": "my-vpn-server", "port": 443, "private_ips": [{"address": "192.168.3.4", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e/reserved_ips/6d353a0f-aeb1-4ae1-832e-1110d10981bb", "id": "6d353a0f-aeb1-4ae1-832e-1110d10981bb", "name": "my-reserved-ip", "resource_type": "subnet_reserved_ip"}], "protocol": "udp", "resource_group": {"href": "https://resource-controller.cloud.ibm.com/v2/resource_groups/fee82deba12e4c0fb69c3b09d1f12345", "id": "fee82deba12e4c0fb69c3b09d1f12345", "name": "my-resource-group"}, "resource_type": "vpn_server", "security_groups": [{"crn": "crn:v1:bluemix:public:is:us-south:a/123456::security-group:be5df5ca-12a0-494b-907e-aa6ec2bfa271", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/security_groups/be5df5ca-12a0-494b-907e-aa6ec2bfa271", "id": "be5df5ca-12a0-494b-907e-aa6ec2bfa271", "name": "my-security-group"}], "subnets": [{"crn": "crn:v1:bluemix:public:is:us-south-1:a/123456::subnet:7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/subnets/7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "id": "7ec86020-1c6e-4889-b3f0-a15f2e50f87e", "name": "my-subnet", "resource_type": "subnet"}], "vpc": {"crn": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "deleted": {"more_info": "https://cloud.ibm.com/apidocs/vpc#deleted-resources"}, "href": "https://us-south.iaas.cloud.ibm.com/v1/vpcs/4727d842-f94f-4a2d-824a-9bc9b02c523b", "id": "4727d842-f94f-4a2d-824a-9bc9b02c523b", "name": "my-vpc", "resource_type": "vpc"}}`) + })) + }) + It(`Invoke UpdateVPNServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.UpdateVPNServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPNServer with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateVPNServerOptions model with no property values + updateVPNServerOptionsModelNew := new(vpcv1.UpdateVPNServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPNServer(updateVPNServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateVPNServer successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + ipModel.Address = core.StringPtr("192.168.3.4") + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + + // Construct an instance of the VPNServerPatch model + vpnServerPatchModel := new(vpcv1.VPNServerPatch) + vpnServerPatchModel.Certificate = certificateInstanceIdentityModel + vpnServerPatchModel.ClientAuthentication = []vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel} + vpnServerPatchModel.ClientDnsServerIps = []vpcv1.IP{*ipModel} + vpnServerPatchModel.ClientIdleTimeout = core.Int64Ptr(int64(600)) + vpnServerPatchModel.ClientIPPool = core.StringPtr("172.16.0.0/16") + vpnServerPatchModel.EnableSplitTunneling = core.BoolPtr(true) + vpnServerPatchModel.Name = core.StringPtr("my-vpn-server") + vpnServerPatchModel.Port = core.Int64Ptr(int64(443)) + vpnServerPatchModel.Protocol = core.StringPtr("udp") + vpnServerPatchModel.Subnets = []vpcv1.SubnetIdentityIntf{subnetIdentityModel} + vpnServerPatchModelAsPatch, asPatchErr := vpnServerPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerOptions model + updateVPNServerOptionsModel := new(vpcv1.UpdateVPNServerOptions) + updateVPNServerOptionsModel.ID = core.StringPtr("testString") + updateVPNServerOptionsModel.VPNServerPatch = vpnServerPatchModelAsPatch + updateVPNServerOptionsModel.IfMatch = core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPNServer(updateVPNServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptions *GetVPNServerClientConfigurationOptions)`, func() { + version := "testString" + getVPNServerClientConfigurationPath := "/vpn_servers/testString/client_configuration" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerClientConfigurationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "text/plain") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"`) + })) + }) + It(`Invoke GetVPNServerClientConfiguration successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetVPNServerClientConfigurationWithContext(ctx, getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetVPNServerClientConfigurationWithContext(ctx, getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerClientConfigurationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "text/plain") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `"client\nproto udp\nremote a8506291.us-south.vpn-server.appdomain.cloud\nport 443\n\ndev tun\nnobind\n\n-----BEGIN CERTIFICATE-----\nxxxxxx\n-----END CERTIFICATE-----\n"`) + })) + }) + It(`Invoke GetVPNServerClientConfiguration successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetVPNServerClientConfiguration(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServerClientConfiguration with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetVPNServerClientConfigurationOptions model with no property values + getVPNServerClientConfigurationOptionsModelNew := new(vpcv1.GetVPNServerClientConfigurationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetVPNServerClientConfiguration successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerClientConfigurationOptions model + getVPNServerClientConfigurationOptionsModel := new(vpcv1.GetVPNServerClientConfigurationOptions) + getVPNServerClientConfigurationOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientConfigurationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServerClientConfiguration(getVPNServerClientConfigurationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions) - Operation response error`, func() { + version := "testString" + listVPNServerClientsPath := "/vpn_servers/testString/clients" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServerClientsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPNServerClients with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerClients(listVPNServerClientsOptions *ListVPNServerClientsOptions)`, func() { + version := "testString" + listVPNServerClientsPath := "/vpn_servers/testString/clients" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServerClientsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "total_count": 132}`) + })) + }) + It(`Invoke ListVPNServerClients successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListVPNServerClientsWithContext(ctx, listVPNServerClientsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListVPNServerClientsWithContext(ctx, listVPNServerClientsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServerClientsPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"created_at"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"clients": [{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}], "first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531/clients?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "total_count": 132}`) + })) + }) + It(`Invoke ListVPNServerClients successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListVPNServerClients(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNServerClients with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListVPNServerClientsOptions model with no property values + listVPNServerClientsOptionsModelNew := new(vpcv1.ListVPNServerClientsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPNServerClients(listVPNServerClientsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListVPNServerClients successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServerClientsOptions model + listVPNServerClientsOptionsModel := new(vpcv1.ListVPNServerClientsOptions) + listVPNServerClientsOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Start = core.StringPtr("testString") + listVPNServerClientsOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerClientsOptionsModel.Sort = core.StringPtr("created_at") + listVPNServerClientsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNServerClients(listVPNServerClientsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VPNServerClientCollection) + nextObject := new(vpcv1.VPNServerClientCollectionNext) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.VPNServerClientCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.VPNServerClientCollection) + nextObject := new(vpcv1.VPNServerClientCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`DeleteVPNServerClient(deleteVPNServerClientOptions *DeleteVPNServerClientOptions)`, func() { + version := "testString" + deleteVPNServerClientPath := "/vpn_servers/testString/clients/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteVPNServerClientPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNServerClient successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteVPNServerClient(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNServerClientOptions model + deleteVPNServerClientOptionsModel := new(vpcv1.DeleteVPNServerClientOptions) + deleteVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNServerClient(deleteVPNServerClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNServerClient with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteVPNServerClientOptions model + deleteVPNServerClientOptionsModel := new(vpcv1.DeleteVPNServerClientOptions) + deleteVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteVPNServerClient(deleteVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNServerClientOptions model with no property values + deleteVPNServerClientOptionsModelNew := new(vpcv1.DeleteVPNServerClientOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNServerClient(deleteVPNServerClientOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions) - Operation response error`, func() { + version := "testString" + getVPNServerClientPath := "/vpn_servers/testString/clients/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerClientPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetVPNServerClient with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerClient(getVPNServerClientOptions *GetVPNServerClientOptions)`, func() { + version := "testString" + getVPNServerClientPath := "/vpn_servers/testString/clients/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerClientPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}`) + })) + }) + It(`Invoke GetVPNServerClient successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetVPNServerClientWithContext(ctx, getVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetVPNServerClientWithContext(ctx, getVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerClientPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"client_ip": {"address": "192.168.3.4"}, "common_name": "CommonName", "created_at": "2019-01-01T12:00:00.000Z", "disconnected_at": "2019-01-01T12:00:00.000Z", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/8e454ead-0db7-48ac-9a8b-2698d8c470a7/clients/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "remote_ip": {"address": "192.168.3.4"}, "remote_port": 22, "resource_type": "vpn_server_client", "status": "connected", "username": "Username"}`) + })) + }) + It(`Invoke GetVPNServerClient successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetVPNServerClient(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServerClient with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetVPNServerClientOptions model with no property values + getVPNServerClientOptionsModelNew := new(vpcv1.GetVPNServerClientOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServerClient(getVPNServerClientOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetVPNServerClient successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerClientOptions model + getVPNServerClientOptionsModel := new(vpcv1.GetVPNServerClientOptions) + getVPNServerClientOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerClientOptionsModel.ID = core.StringPtr("testString") + getVPNServerClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServerClient(getVPNServerClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DisconnectVPNClient(disconnectVPNClientOptions *DisconnectVPNClientOptions)`, func() { + version := "testString" + disconnectVPNClientPath := "/vpn_servers/testString/clients/testString/disconnect" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(disconnectVPNClientPath)) + Expect(req.Method).To(Equal("POST")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DisconnectVPNClient successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DisconnectVPNClient(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DisconnectVPNClientOptions model + disconnectVPNClientOptionsModel := new(vpcv1.DisconnectVPNClientOptions) + disconnectVPNClientOptionsModel.VPNServerID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.ID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DisconnectVPNClient(disconnectVPNClientOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DisconnectVPNClient with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DisconnectVPNClientOptions model + disconnectVPNClientOptionsModel := new(vpcv1.DisconnectVPNClientOptions) + disconnectVPNClientOptionsModel.VPNServerID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.ID = core.StringPtr("testString") + disconnectVPNClientOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DisconnectVPNClient(disconnectVPNClientOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DisconnectVPNClientOptions model with no property values + disconnectVPNClientOptionsModelNew := new(vpcv1.DisconnectVPNClientOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DisconnectVPNClient(disconnectVPNClientOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions) - Operation response error`, func() { + version := "testString" + listVPNServerRoutesPath := "/vpn_servers/testString/routes" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServerRoutesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke ListVPNServerRoutes with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListVPNServerRoutes(listVPNServerRoutesOptions *ListVPNServerRoutesOptions)`, func() { + version := "testString" + listVPNServerRoutesPath := "/vpn_servers/testString/routes" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServerRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) + })) + }) + It(`Invoke ListVPNServerRoutes successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.ListVPNServerRoutesWithContext(ctx, listVPNServerRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.ListVPNServerRoutesWithContext(ctx, listVPNServerRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listVPNServerRoutesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["sort"]).To(Equal([]string{"name"})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"first": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?limit=20"}, "limit": 20, "next": {"href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-982d72b7-db1b-4606-afb2-ed6bd4b0bed1/routes?start=a5e812a2-62c0-4555-86a5-907106760c56&limit=20"}, "routes": [{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}], "total_count": 132}`) + })) + }) + It(`Invoke ListVPNServerRoutes successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.ListVPNServerRoutes(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke ListVPNServerRoutes with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the ListVPNServerRoutesOptions model with no property values + listVPNServerRoutesOptionsModelNew := new(vpcv1.ListVPNServerRoutesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListVPNServerRoutes successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the ListVPNServerRoutesOptions model + listVPNServerRoutesOptionsModel := new(vpcv1.ListVPNServerRoutesOptions) + listVPNServerRoutesOptionsModel.VPNServerID = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Start = core.StringPtr("testString") + listVPNServerRoutesOptionsModel.Limit = core.Int64Ptr(int64(1)) + listVPNServerRoutesOptionsModel.Sort = core.StringPtr("name") + listVPNServerRoutesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.ListVPNServerRoutes(listVPNServerRoutesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(vpcv1.VPNServerRouteCollection) + nextObject := new(vpcv1.VPNServerRouteCollectionNext) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(vpcv1.VPNServerRouteCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(vpcv1.VPNServerRouteCollection) + nextObject := new(vpcv1.VPNServerRouteCollectionNext) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + }) + Describe(`CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions) - Operation response error`, func() { + version := "testString" + createVPNServerRoutePath := "/vpn_servers/testString/routes" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createVPNServerRoutePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateVPNServerRoute with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateVPNServerRoute(createVPNServerRouteOptions *CreateVPNServerRouteOptions)`, func() { + version := "testString" + createVPNServerRoutePath := "/vpn_servers/testString/routes" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createVPNServerRoutePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke CreateVPNServerRoute successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.CreateVPNServerRouteWithContext(ctx, createVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.CreateVPNServerRouteWithContext(ctx, createVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createVPNServerRoutePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke CreateVPNServerRoute successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.CreateVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateVPNServerRoute with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateVPNServerRouteOptions model with no property values + createVPNServerRouteOptionsModelNew := new(vpcv1.CreateVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateVPNServerRoute successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the CreateVPNServerRouteOptions model + createVPNServerRouteOptionsModel := new(vpcv1.CreateVPNServerRouteOptions) + createVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + createVPNServerRouteOptionsModel.Destination = core.StringPtr("172.16.0.0/16") + createVPNServerRouteOptionsModel.Action = core.StringPtr("deliver") + createVPNServerRouteOptionsModel.Name = core.StringPtr("my-vpn-route-2") + createVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.CreateVPNServerRoute(createVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`DeleteVPNServerRoute(deleteVPNServerRouteOptions *DeleteVPNServerRouteOptions)`, func() { + version := "testString" + deleteVPNServerRoutePath := "/vpn_servers/testString/routes/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteVPNServerRoutePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.WriteHeader(202) + })) + }) + It(`Invoke DeleteVPNServerRoute successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := vpcService.DeleteVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteVPNServerRouteOptions model + deleteVPNServerRouteOptionsModel := new(vpcv1.DeleteVPNServerRouteOptions) + deleteVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteVPNServerRoute with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the DeleteVPNServerRouteOptions model + deleteVPNServerRouteOptionsModel := new(vpcv1.DeleteVPNServerRouteOptions) + deleteVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + deleteVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteVPNServerRouteOptions model with no property values + deleteVPNServerRouteOptionsModelNew := new(vpcv1.DeleteVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = vpcService.DeleteVPNServerRoute(deleteVPNServerRouteOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions) - Operation response error`, func() { + version := "testString" + getVPNServerRoutePath := "/vpn_servers/testString/routes/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerRoutePath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetVPNServerRoute with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetVPNServerRoute(getVPNServerRouteOptions *GetVPNServerRouteOptions)`, func() { + version := "testString" + getVPNServerRoutePath := "/vpn_servers/testString/routes/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke GetVPNServerRoute successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.GetVPNServerRouteWithContext(ctx, getVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.GetVPNServerRouteWithContext(ctx, getVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getVPNServerRoutePath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke GetVPNServerRoute successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.GetVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke GetVPNServerRoute with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the GetVPNServerRouteOptions model with no property values + getVPNServerRouteOptionsModelNew := new(vpcv1.GetVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke GetVPNServerRoute successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the GetVPNServerRouteOptions model + getVPNServerRouteOptionsModel := new(vpcv1.GetVPNServerRouteOptions) + getVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + getVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.GetVPNServerRoute(getVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions) - Operation response error`, func() { + version := "testString" + updateVPNServerRoutePath := "/vpn_servers/testString/routes/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateVPNServerRoutePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateVPNServerRoute with error: Operation response processing error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + vpcService.EnableRetries(0, 0) + result, response, operationErr = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateVPNServerRoute(updateVPNServerRouteOptions *UpdateVPNServerRouteOptions)`, func() { + version := "testString" + updateVPNServerRoutePath := "/vpn_servers/testString/routes/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateVPNServerRoutePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke UpdateVPNServerRoute successfully with retries`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + vpcService.EnableRetries(0, 0) + + // Construct an instance of the VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := vpcService.UpdateVPNServerRouteWithContext(ctx, updateVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + vpcService.DisableRetries() + result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = vpcService.UpdateVPNServerRouteWithContext(ctx, updateVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateVPNServerRoutePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.URL.Query()["version"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["generation"]).To(Equal([]string{fmt.Sprint(int64(2))})) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"action": "deliver", "created_at": "2019-01-01T12:00:00.000Z", "destination": "192.168.3.0/24", "href": "https://us-south.iaas.cloud.ibm.com/v1/vpn_servers/r006-8e454ead-0db7-48ac-9a8b-2698d8c470a7/routes/r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "id": "r006-1a15dca5-7e33-45e1-b7c5-bc690e569531", "lifecycle_state": "stable", "name": "my-vpn-route-1", "resource_type": "vpn_server_route"}`) + })) + }) + It(`Invoke UpdateVPNServerRoute successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := vpcService.UpdateVPNServerRoute(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke UpdateVPNServerRoute with error: Operation validation and request error`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := vpcService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the UpdateVPNServerRouteOptions model with no property values + updateVPNServerRouteOptionsModelNew := new(vpcv1.UpdateVPNServerRouteOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke UpdateVPNServerRoute successfully`, func() { + vpcService, serviceErr := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + Version: core.StringPtr(version), + }) + Expect(serviceErr).To(BeNil()) + Expect(vpcService).ToNot(BeNil()) + + // Construct an instance of the VPNServerRoutePatch model + vpnServerRoutePatchModel := new(vpcv1.VPNServerRoutePatch) + vpnServerRoutePatchModel.Name = core.StringPtr("my-vpn-route-2") + vpnServerRoutePatchModelAsPatch, asPatchErr := vpnServerRoutePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateVPNServerRouteOptions model + updateVPNServerRouteOptionsModel := new(vpcv1.UpdateVPNServerRouteOptions) + updateVPNServerRouteOptionsModel.VPNServerID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.ID = core.StringPtr("testString") + updateVPNServerRouteOptionsModel.VPNServerRoutePatch = vpnServerRoutePatchModelAsPatch + updateVPNServerRouteOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := vpcService.UpdateVPNServerRoute(updateVPNServerRouteOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) Describe(`ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) - Operation response error`, func() { version := "testString" listLoadBalancerProfilesPath := "/load_balancer/profiles" @@ -75609,11 +78689,11 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel.Name = core.StringPtr("us-south-1") Expect(zoneIdentityModel.Name).To(Equal(core.StringPtr("us-south-1"))) - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - Expect(routeNextHopPrototypeModel).ToNot(BeNil()) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") - Expect(routeNextHopPrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + Expect(routePrototypeNextHopModel).ToNot(BeNil()) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) // Construct an instance of the CreateVPCRouteOptions model vpcID := "testString" @@ -75624,24 +78704,30 @@ var _ = Describe(`VpcV1`, func() { createVPCRouteOptionsModel.SetDestination("192.168.3.0/24") createVPCRouteOptionsModel.SetZone(zoneIdentityModel) createVPCRouteOptionsModel.SetAction("deliver") - createVPCRouteOptionsModel.SetName("my-route-2") - createVPCRouteOptionsModel.SetNextHop(routeNextHopPrototypeModel) + createVPCRouteOptionsModel.SetName("my-route-1") + createVPCRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) createVPCRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createVPCRouteOptionsModel).ToNot(BeNil()) Expect(createVPCRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(createVPCRouteOptionsModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) Expect(createVPCRouteOptionsModel.Zone).To(Equal(zoneIdentityModel)) Expect(createVPCRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) - Expect(createVPCRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-2"))) - Expect(createVPCRouteOptionsModel.NextHop).To(Equal(routeNextHopPrototypeModel)) + Expect(createVPCRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) + Expect(createVPCRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) Expect(createVPCRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateVPCRoutingTableOptions successfully`, func() { - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - Expect(routeNextHopPrototypeModel).ToNot(BeNil()) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") - Expect(routeNextHopPrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + // Construct an instance of the ResourceFilter model + resourceFilterModel := new(vpcv1.ResourceFilter) + Expect(resourceFilterModel).ToNot(BeNil()) + resourceFilterModel.ResourceType = core.StringPtr("vpn_server") + Expect(resourceFilterModel.ResourceType).To(Equal(core.StringPtr("vpn_server"))) + + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + Expect(routePrototypeNextHopModel).ToNot(BeNil()) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) // Construct an instance of the ZoneIdentityByName model zoneIdentityModel := new(vpcv1.ZoneIdentityByName) @@ -75654,19 +78740,20 @@ var _ = Describe(`VpcV1`, func() { Expect(routePrototypeModel).ToNot(BeNil()) routePrototypeModel.Action = core.StringPtr("deliver") routePrototypeModel.Destination = core.StringPtr("192.168.3.0/24") - routePrototypeModel.Name = core.StringPtr("my-route-2") - routePrototypeModel.NextHop = routeNextHopPrototypeModel + routePrototypeModel.Name = core.StringPtr("my-route-1") + routePrototypeModel.NextHop = routePrototypeNextHopModel routePrototypeModel.Zone = zoneIdentityModel Expect(routePrototypeModel.Action).To(Equal(core.StringPtr("deliver"))) Expect(routePrototypeModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) - Expect(routePrototypeModel.Name).To(Equal(core.StringPtr("my-route-2"))) - Expect(routePrototypeModel.NextHop).To(Equal(routeNextHopPrototypeModel)) + Expect(routePrototypeModel.Name).To(Equal(core.StringPtr("my-route-1"))) + Expect(routePrototypeModel.NextHop).To(Equal(routePrototypeNextHopModel)) Expect(routePrototypeModel.Zone).To(Equal(zoneIdentityModel)) // Construct an instance of the CreateVPCRoutingTableOptions model vpcID := "testString" createVPCRoutingTableOptionsModel := vpcService.NewCreateVPCRoutingTableOptions(vpcID) createVPCRoutingTableOptionsModel.SetVPCID("testString") + createVPCRoutingTableOptionsModel.SetAcceptRoutesFrom([]vpcv1.ResourceFilter{*resourceFilterModel}) createVPCRoutingTableOptionsModel.SetName("my-routing-table-2") createVPCRoutingTableOptionsModel.SetRouteDirectLinkIngress(false) createVPCRoutingTableOptionsModel.SetRouteTransitGatewayIngress(false) @@ -75675,6 +78762,7 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createVPCRoutingTableOptionsModel).ToNot(BeNil()) Expect(createVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) + Expect(createVPCRoutingTableOptionsModel.AcceptRoutesFrom).To(Equal([]vpcv1.ResourceFilter{*resourceFilterModel})) Expect(createVPCRoutingTableOptionsModel.Name).To(Equal(core.StringPtr("my-routing-table-2"))) Expect(createVPCRoutingTableOptionsModel.RouteDirectLinkIngress).To(Equal(core.BoolPtr(false))) Expect(createVPCRoutingTableOptionsModel.RouteTransitGatewayIngress).To(Equal(core.BoolPtr(false))) @@ -75689,11 +78777,11 @@ var _ = Describe(`VpcV1`, func() { zoneIdentityModel.Name = core.StringPtr("us-south-1") Expect(zoneIdentityModel.Name).To(Equal(core.StringPtr("us-south-1"))) - // Construct an instance of the RouteNextHopPrototypeRouteNextHopIP model - routeNextHopPrototypeModel := new(vpcv1.RouteNextHopPrototypeRouteNextHopIP) - Expect(routeNextHopPrototypeModel).ToNot(BeNil()) - routeNextHopPrototypeModel.Address = core.StringPtr("192.168.3.4") - Expect(routeNextHopPrototypeModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + // Construct an instance of the RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP model + routePrototypeNextHopModel := new(vpcv1.RoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP) + Expect(routePrototypeNextHopModel).ToNot(BeNil()) + routePrototypeNextHopModel.Address = core.StringPtr("192.168.3.4") + Expect(routePrototypeNextHopModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) // Construct an instance of the CreateVPCRoutingTableRouteOptions model vpcID := "testString" @@ -75706,8 +78794,8 @@ var _ = Describe(`VpcV1`, func() { createVPCRoutingTableRouteOptionsModel.SetDestination("192.168.3.0/24") createVPCRoutingTableRouteOptionsModel.SetZone(zoneIdentityModel) createVPCRoutingTableRouteOptionsModel.SetAction("deliver") - createVPCRoutingTableRouteOptionsModel.SetName("my-route-2") - createVPCRoutingTableRouteOptionsModel.SetNextHop(routeNextHopPrototypeModel) + createVPCRoutingTableRouteOptionsModel.SetName("my-route-1") + createVPCRoutingTableRouteOptionsModel.SetNextHop(routePrototypeNextHopModel) createVPCRoutingTableRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createVPCRoutingTableRouteOptionsModel).ToNot(BeNil()) Expect(createVPCRoutingTableRouteOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) @@ -75715,8 +78803,8 @@ var _ = Describe(`VpcV1`, func() { Expect(createVPCRoutingTableRouteOptionsModel.Destination).To(Equal(core.StringPtr("192.168.3.0/24"))) Expect(createVPCRoutingTableRouteOptionsModel.Zone).To(Equal(zoneIdentityModel)) Expect(createVPCRoutingTableRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) - Expect(createVPCRoutingTableRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-2"))) - Expect(createVPCRoutingTableRouteOptionsModel.NextHop).To(Equal(routeNextHopPrototypeModel)) + Expect(createVPCRoutingTableRouteOptionsModel.Name).To(Equal(core.StringPtr("my-route-1"))) + Expect(createVPCRoutingTableRouteOptionsModel.NextHop).To(Equal(routePrototypeNextHopModel)) Expect(createVPCRoutingTableRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateVPNGatewayConnectionOptions successfully`, func() { @@ -75808,6 +78896,102 @@ var _ = Describe(`VpcV1`, func() { Expect(createVPNGatewayOptionsModel.VPNGatewayPrototype).To(Equal(vpnGatewayPrototypeModel)) Expect(createVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateVPNServerOptions successfully`, func() { + // Construct an instance of the CertificateInstanceIdentityByCRN model + certificateInstanceIdentityModel := new(vpcv1.CertificateInstanceIdentityByCRN) + Expect(certificateInstanceIdentityModel).ToNot(BeNil()) + certificateInstanceIdentityModel.CRN = core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5") + Expect(certificateInstanceIdentityModel.CRN).To(Equal(core.StringPtr("crn:v1:bluemix:public:secrets-manager:us-south:a/123456:36fa422d-080d-4d83-8d2d-86851b4001df:secret:2e786aab-42fa-63ed-14f8-d66d552f4dd5"))) + + // Construct an instance of the VPNServerAuthenticationByUsernameIDProviderByIam model + vpnServerAuthenticationByUsernameIDProviderModel := new(vpcv1.VPNServerAuthenticationByUsernameIDProviderByIam) + Expect(vpnServerAuthenticationByUsernameIDProviderModel).ToNot(BeNil()) + vpnServerAuthenticationByUsernameIDProviderModel.ProviderType = core.StringPtr("iam") + Expect(vpnServerAuthenticationByUsernameIDProviderModel.ProviderType).To(Equal(core.StringPtr("iam"))) + + // Construct an instance of the VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype model + vpnServerAuthenticationPrototypeModel := new(vpcv1.VPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype) + Expect(vpnServerAuthenticationPrototypeModel).ToNot(BeNil()) + vpnServerAuthenticationPrototypeModel.Method = core.StringPtr("username") + vpnServerAuthenticationPrototypeModel.IdentityProvider = vpnServerAuthenticationByUsernameIDProviderModel + Expect(vpnServerAuthenticationPrototypeModel.Method).To(Equal(core.StringPtr("username"))) + Expect(vpnServerAuthenticationPrototypeModel.IdentityProvider).To(Equal(vpnServerAuthenticationByUsernameIDProviderModel)) + + // Construct an instance of the SubnetIdentityByID model + subnetIdentityModel := new(vpcv1.SubnetIdentityByID) + Expect(subnetIdentityModel).ToNot(BeNil()) + subnetIdentityModel.ID = core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e") + Expect(subnetIdentityModel.ID).To(Equal(core.StringPtr("7ec86020-1c6e-4889-b3f0-a15f2e50f87e"))) + + // Construct an instance of the IP model + ipModel := new(vpcv1.IP) + Expect(ipModel).ToNot(BeNil()) + ipModel.Address = core.StringPtr("192.168.3.4") + Expect(ipModel.Address).To(Equal(core.StringPtr("192.168.3.4"))) + + // Construct an instance of the ResourceGroupIdentityByID model + resourceGroupIdentityModel := new(vpcv1.ResourceGroupIdentityByID) + Expect(resourceGroupIdentityModel).ToNot(BeNil()) + resourceGroupIdentityModel.ID = core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345") + Expect(resourceGroupIdentityModel.ID).To(Equal(core.StringPtr("fee82deba12e4c0fb69c3b09d1f12345"))) + + // Construct an instance of the SecurityGroupIdentityByID model + securityGroupIdentityModel := new(vpcv1.SecurityGroupIdentityByID) + Expect(securityGroupIdentityModel).ToNot(BeNil()) + securityGroupIdentityModel.ID = core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271") + Expect(securityGroupIdentityModel.ID).To(Equal(core.StringPtr("be5df5ca-12a0-494b-907e-aa6ec2bfa271"))) + + // Construct an instance of the CreateVPNServerOptions model + var createVPNServerOptionsCertificate vpcv1.CertificateInstanceIdentityIntf = nil + createVPNServerOptionsClientAuthentication := []vpcv1.VPNServerAuthenticationPrototypeIntf{} + createVPNServerOptionsClientIPPool := "172.16.0.0/16" + createVPNServerOptionsSubnets := []vpcv1.SubnetIdentityIntf{} + createVPNServerOptionsModel := vpcService.NewCreateVPNServerOptions(createVPNServerOptionsCertificate, createVPNServerOptionsClientAuthentication, createVPNServerOptionsClientIPPool, createVPNServerOptionsSubnets) + createVPNServerOptionsModel.SetCertificate(certificateInstanceIdentityModel) + createVPNServerOptionsModel.SetClientAuthentication([]vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel}) + createVPNServerOptionsModel.SetClientIPPool("172.16.0.0/16") + createVPNServerOptionsModel.SetSubnets([]vpcv1.SubnetIdentityIntf{subnetIdentityModel}) + createVPNServerOptionsModel.SetClientDnsServerIps([]vpcv1.IP{*ipModel}) + createVPNServerOptionsModel.SetClientIdleTimeout(int64(600)) + createVPNServerOptionsModel.SetEnableSplitTunneling(false) + createVPNServerOptionsModel.SetName("my-vpn-server") + createVPNServerOptionsModel.SetPort(int64(443)) + createVPNServerOptionsModel.SetProtocol("udp") + createVPNServerOptionsModel.SetResourceGroup(resourceGroupIdentityModel) + createVPNServerOptionsModel.SetSecurityGroups([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel}) + createVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPNServerOptionsModel).ToNot(BeNil()) + Expect(createVPNServerOptionsModel.Certificate).To(Equal(certificateInstanceIdentityModel)) + Expect(createVPNServerOptionsModel.ClientAuthentication).To(Equal([]vpcv1.VPNServerAuthenticationPrototypeIntf{vpnServerAuthenticationPrototypeModel})) + Expect(createVPNServerOptionsModel.ClientIPPool).To(Equal(core.StringPtr("172.16.0.0/16"))) + Expect(createVPNServerOptionsModel.Subnets).To(Equal([]vpcv1.SubnetIdentityIntf{subnetIdentityModel})) + Expect(createVPNServerOptionsModel.ClientDnsServerIps).To(Equal([]vpcv1.IP{*ipModel})) + Expect(createVPNServerOptionsModel.ClientIdleTimeout).To(Equal(core.Int64Ptr(int64(600)))) + Expect(createVPNServerOptionsModel.EnableSplitTunneling).To(Equal(core.BoolPtr(false))) + Expect(createVPNServerOptionsModel.Name).To(Equal(core.StringPtr("my-vpn-server"))) + Expect(createVPNServerOptionsModel.Port).To(Equal(core.Int64Ptr(int64(443)))) + Expect(createVPNServerOptionsModel.Protocol).To(Equal(core.StringPtr("udp"))) + Expect(createVPNServerOptionsModel.ResourceGroup).To(Equal(resourceGroupIdentityModel)) + Expect(createVPNServerOptionsModel.SecurityGroups).To(Equal([]vpcv1.SecurityGroupIdentityIntf{securityGroupIdentityModel})) + Expect(createVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCreateVPNServerRouteOptions successfully`, func() { + // Construct an instance of the CreateVPNServerRouteOptions model + vpnServerID := "testString" + createVPNServerRouteOptionsDestination := "172.16.0.0/16" + createVPNServerRouteOptionsModel := vpcService.NewCreateVPNServerRouteOptions(vpnServerID, createVPNServerRouteOptionsDestination) + createVPNServerRouteOptionsModel.SetVPNServerID("testString") + createVPNServerRouteOptionsModel.SetDestination("172.16.0.0/16") + createVPNServerRouteOptionsModel.SetAction("deliver") + createVPNServerRouteOptionsModel.SetName("my-vpn-route-2") + createVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(createVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(createVPNServerRouteOptionsModel.Destination).To(Equal(core.StringPtr("172.16.0.0/16"))) + Expect(createVPNServerRouteOptionsModel.Action).To(Equal(core.StringPtr("deliver"))) + Expect(createVPNServerRouteOptionsModel.Name).To(Equal(core.StringPtr("my-vpn-route-2"))) + Expect(createVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteBackupPolicyOptions successfully`, func() { // Construct an instance of the DeleteBackupPolicyOptions model id := "testString" @@ -76348,10 +79532,12 @@ var _ = Describe(`VpcV1`, func() { deleteVPCRoutingTableOptionsModel := vpcService.NewDeleteVPCRoutingTableOptions(vpcID, id) deleteVPCRoutingTableOptionsModel.SetVPCID("testString") deleteVPCRoutingTableOptionsModel.SetID("testString") + deleteVPCRoutingTableOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) deleteVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteVPCRoutingTableOptionsModel).ToNot(BeNil()) Expect(deleteVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(deleteVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPCRoutingTableOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(deleteVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteVPCRoutingTableRouteOptions successfully`, func() { @@ -76393,6 +79579,57 @@ var _ = Describe(`VpcV1`, func() { Expect(deleteVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteVPNServerClientOptions successfully`, func() { + // Construct an instance of the DeleteVPNServerClientOptions model + vpnServerID := "testString" + id := "testString" + deleteVPNServerClientOptionsModel := vpcService.NewDeleteVPNServerClientOptions(vpnServerID, id) + deleteVPNServerClientOptionsModel.SetVPNServerID("testString") + deleteVPNServerClientOptionsModel.SetID("testString") + deleteVPNServerClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNServerClientOptionsModel).ToNot(BeNil()) + Expect(deleteVPNServerClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPNServerOptions successfully`, func() { + // Construct an instance of the DeleteVPNServerOptions model + id := "testString" + deleteVPNServerOptionsModel := vpcService.NewDeleteVPNServerOptions(id) + deleteVPNServerOptionsModel.SetID("testString") + deleteVPNServerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + deleteVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNServerOptionsModel).ToNot(BeNil()) + Expect(deleteVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(deleteVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteVPNServerRouteOptions successfully`, func() { + // Construct an instance of the DeleteVPNServerRouteOptions model + vpnServerID := "testString" + id := "testString" + deleteVPNServerRouteOptionsModel := vpcService.NewDeleteVPNServerRouteOptions(vpnServerID, id) + deleteVPNServerRouteOptionsModel.SetVPNServerID("testString") + deleteVPNServerRouteOptionsModel.SetID("testString") + deleteVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(deleteVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDisconnectVPNClientOptions successfully`, func() { + // Construct an instance of the DisconnectVPNClientOptions model + vpnServerID := "testString" + id := "testString" + disconnectVPNClientOptionsModel := vpcService.NewDisconnectVPNClientOptions(vpnServerID, id) + disconnectVPNClientOptionsModel.SetVPNServerID("testString") + disconnectVPNClientOptionsModel.SetID("testString") + disconnectVPNClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(disconnectVPNClientOptionsModel).ToNot(BeNil()) + Expect(disconnectVPNClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(disconnectVPNClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(disconnectVPNClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetBackupPolicyOptions successfully`, func() { // Construct an instance of the GetBackupPolicyOptions model id := "testString" @@ -76455,22 +79692,6 @@ var _ = Describe(`VpcV1`, func() { Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getBareMetalServerNetworkInterfaceFloatingIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewGetBareMetalServerNetworkInterfaceIPOptions successfully`, func() { - // Construct an instance of the GetBareMetalServerNetworkInterfaceIPOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - id := "testString" - getBareMetalServerNetworkInterfaceIPOptionsModel := vpcService.NewGetBareMetalServerNetworkInterfaceIPOptions(bareMetalServerID, networkInterfaceID, id) - getBareMetalServerNetworkInterfaceIPOptionsModel.SetBareMetalServerID("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.SetNetworkInterfaceID("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.SetID("testString") - getBareMetalServerNetworkInterfaceIPOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel).ToNot(BeNil()) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getBareMetalServerNetworkInterfaceIPOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewGetBareMetalServerNetworkInterfaceOptions successfully`, func() { // Construct an instance of the GetBareMetalServerNetworkInterfaceOptions model bareMetalServerID := "testString" @@ -77229,6 +80450,58 @@ var _ = Describe(`VpcV1`, func() { Expect(getVPNGatewayOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetVPNServerClientConfigurationOptions successfully`, func() { + // Construct an instance of the GetVPNServerClientConfigurationOptions model + id := "testString" + getVPNServerClientConfigurationOptionsModel := vpcService.NewGetVPNServerClientConfigurationOptions(id) + getVPNServerClientConfigurationOptionsModel.SetID("testString") + getVPNServerClientConfigurationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerClientConfigurationOptionsModel).ToNot(BeNil()) + Expect(getVPNServerClientConfigurationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerClientConfigurationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNServerClientOptions successfully`, func() { + // Construct an instance of the GetVPNServerClientOptions model + vpnServerID := "testString" + id := "testString" + getVPNServerClientOptionsModel := vpcService.NewGetVPNServerClientOptions(vpnServerID, id) + getVPNServerClientOptionsModel.SetVPNServerID("testString") + getVPNServerClientOptionsModel.SetID("testString") + getVPNServerClientOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerClientOptionsModel).ToNot(BeNil()) + Expect(getVPNServerClientOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerClientOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerClientOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNServerOptions successfully`, func() { + // Construct an instance of the GetVPNServerOptions model + id := "testString" + getVPNServerOptionsModel := vpcService.NewGetVPNServerOptions(id) + getVPNServerOptionsModel.SetID("testString") + getVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerOptionsModel).ToNot(BeNil()) + Expect(getVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetVPNServerRouteOptions successfully`, func() { + // Construct an instance of the GetVPNServerRouteOptions model + vpnServerID := "testString" + id := "testString" + getVPNServerRouteOptionsModel := vpcService.NewGetVPNServerRouteOptions(vpnServerID, id) + getVPNServerRouteOptionsModel.SetVPNServerID("testString") + getVPNServerRouteOptionsModel.SetID("testString") + getVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(getVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewIP successfully`, func() { + address := "192.168.3.4" + _model, err := vpcService.NewIP(address) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewImageFilePrototype successfully`, func() { href := "cos://us-south/custom-image-vpc-bucket/customImage-0.vhd" _model, err := vpcService.NewImageFilePrototype(href) @@ -77298,19 +80571,6 @@ var _ = Describe(`VpcV1`, func() { Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) Expect(listBareMetalServerNetworkInterfaceFloatingIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewListBareMetalServerNetworkInterfaceIpsOptions successfully`, func() { - // Construct an instance of the ListBareMetalServerNetworkInterfaceIpsOptions model - bareMetalServerID := "testString" - networkInterfaceID := "testString" - listBareMetalServerNetworkInterfaceIpsOptionsModel := vpcService.NewListBareMetalServerNetworkInterfaceIpsOptions(bareMetalServerID, networkInterfaceID) - listBareMetalServerNetworkInterfaceIpsOptionsModel.SetBareMetalServerID("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.SetNetworkInterfaceID("testString") - listBareMetalServerNetworkInterfaceIpsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel).ToNot(BeNil()) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.BareMetalServerID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.NetworkInterfaceID).To(Equal(core.StringPtr("testString"))) - Expect(listBareMetalServerNetworkInterfaceIpsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewListBareMetalServerNetworkInterfacesOptions successfully`, func() { // Construct an instance of the ListBareMetalServerNetworkInterfacesOptions model bareMetalServerID := "testString" @@ -78168,6 +81428,55 @@ var _ = Describe(`VpcV1`, func() { Expect(listVPNGatewaysOptionsModel.Mode).To(Equal(core.StringPtr("route"))) Expect(listVPNGatewaysOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListVPNServerClientsOptions successfully`, func() { + // Construct an instance of the ListVPNServerClientsOptions model + vpnServerID := "testString" + listVPNServerClientsOptionsModel := vpcService.NewListVPNServerClientsOptions(vpnServerID) + listVPNServerClientsOptionsModel.SetVPNServerID("testString") + listVPNServerClientsOptionsModel.SetStart("testString") + listVPNServerClientsOptionsModel.SetLimit(int64(1)) + listVPNServerClientsOptionsModel.SetSort("created_at") + listVPNServerClientsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNServerClientsOptionsModel).ToNot(BeNil()) + Expect(listVPNServerClientsOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerClientsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerClientsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServerClientsOptionsModel.Sort).To(Equal(core.StringPtr("created_at"))) + Expect(listVPNServerClientsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNServerRoutesOptions successfully`, func() { + // Construct an instance of the ListVPNServerRoutesOptions model + vpnServerID := "testString" + listVPNServerRoutesOptionsModel := vpcService.NewListVPNServerRoutesOptions(vpnServerID) + listVPNServerRoutesOptionsModel.SetVPNServerID("testString") + listVPNServerRoutesOptionsModel.SetStart("testString") + listVPNServerRoutesOptionsModel.SetLimit(int64(1)) + listVPNServerRoutesOptionsModel.SetSort("name") + listVPNServerRoutesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNServerRoutesOptionsModel).ToNot(BeNil()) + Expect(listVPNServerRoutesOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerRoutesOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServerRoutesOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServerRoutesOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listVPNServerRoutesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListVPNServersOptions successfully`, func() { + // Construct an instance of the ListVPNServersOptions model + listVPNServersOptionsModel := vpcService.NewListVPNServersOptions() + listVPNServersOptionsModel.SetName("testString") + listVPNServersOptionsModel.SetStart("testString") + listVPNServersOptionsModel.SetLimit(int64(1)) + listVPNServersOptionsModel.SetResourceGroupID("testString") + listVPNServersOptionsModel.SetSort("name") + listVPNServersOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listVPNServersOptionsModel).ToNot(BeNil()) + Expect(listVPNServersOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServersOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServersOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listVPNServersOptionsModel.ResourceGroupID).To(Equal(core.StringPtr("testString"))) + Expect(listVPNServersOptionsModel.Sort).To(Equal(core.StringPtr("name"))) + Expect(listVPNServersOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewLoadBalancerListenerHTTPSRedirectPrototype successfully`, func() { httpStatusCode := int64(301) var listener vpcv1.LoadBalancerListenerIdentityIntf = nil @@ -79140,11 +82449,13 @@ var _ = Describe(`VpcV1`, func() { updateVPCRoutingTableOptionsModel.SetVPCID("testString") updateVPCRoutingTableOptionsModel.SetID("testString") updateVPCRoutingTableOptionsModel.SetRoutingTablePatch(make(map[string]interface{})) + updateVPCRoutingTableOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) updateVPCRoutingTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateVPCRoutingTableOptionsModel).ToNot(BeNil()) Expect(updateVPCRoutingTableOptionsModel.VPCID).To(Equal(core.StringPtr("testString"))) Expect(updateVPCRoutingTableOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateVPCRoutingTableOptionsModel.RoutingTablePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPCRoutingTableOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) Expect(updateVPCRoutingTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateVPCRoutingTableRouteOptions successfully`, func() { @@ -79195,6 +82506,37 @@ var _ = Describe(`VpcV1`, func() { Expect(updateVPNGatewayOptionsModel.VPNGatewayPatch).To(Equal(make(map[string]interface{}))) Expect(updateVPNGatewayOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateVPNServerOptions successfully`, func() { + // Construct an instance of the UpdateVPNServerOptions model + id := "testString" + vpnServerPatch := make(map[string]interface{}) + updateVPNServerOptionsModel := vpcService.NewUpdateVPNServerOptions(id, vpnServerPatch) + updateVPNServerOptionsModel.SetID("testString") + updateVPNServerOptionsModel.SetVPNServerPatch(make(map[string]interface{})) + updateVPNServerOptionsModel.SetIfMatch(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`) + updateVPNServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPNServerOptionsModel).ToNot(BeNil()) + Expect(updateVPNServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNServerOptionsModel.VPNServerPatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNServerOptionsModel.IfMatch).To(Equal(core.StringPtr(`W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"`))) + Expect(updateVPNServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdateVPNServerRouteOptions successfully`, func() { + // Construct an instance of the UpdateVPNServerRouteOptions model + vpnServerID := "testString" + id := "testString" + vpnServerRoutePatch := make(map[string]interface{}) + updateVPNServerRouteOptionsModel := vpcService.NewUpdateVPNServerRouteOptions(vpnServerID, id, vpnServerRoutePatch) + updateVPNServerRouteOptionsModel.SetVPNServerID("testString") + updateVPNServerRouteOptionsModel.SetID("testString") + updateVPNServerRouteOptionsModel.SetVPNServerRoutePatch(make(map[string]interface{})) + updateVPNServerRouteOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateVPNServerRouteOptionsModel).ToNot(BeNil()) + Expect(updateVPNServerRouteOptionsModel.VPNServerID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNServerRouteOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateVPNServerRouteOptionsModel.VPNServerRoutePatch).To(Equal(make(map[string]interface{}))) + Expect(updateVPNServerRouteOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewVolumeAttachmentPrototypeInstanceByImageContext successfully`, func() { var volume *vpcv1.VolumePrototypeInstanceByImageContext = nil _, err := vpcService.NewVolumeAttachmentPrototypeInstanceByImageContext(volume) @@ -79714,9 +83056,9 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewRouteNextHopPrototypeRouteNextHopIP successfully`, func() { + It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP successfully`, func() { address := "192.168.3.4" - _model, err := vpcService.NewRouteNextHopPrototypeRouteNextHopIP(address) + _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeRouteNextHopIP(address) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) @@ -79971,6 +83313,24 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewVPNGatewayPrototypeVPNGatewayRouteModePrototype(subnet) Expect(err).ToNot(BeNil()) }) + It(`Invoke NewVPNServerAuthenticationByUsernameIDProviderByIam successfully`, func() { + providerType := "iam" + _model, err := vpcService.NewVPNServerAuthenticationByUsernameIDProviderByIam(providerType) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype successfully`, func() { + method := "certificate" + var clientCa vpcv1.CertificateInstanceIdentityIntf = nil + _, err := vpcService.NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByCertificatePrototype(method, clientCa) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype successfully`, func() { + method := "username" + var identityProvider vpcv1.VPNServerAuthenticationByUsernameIDProviderIntf = nil + _, err := vpcService.NewVPNServerAuthenticationPrototypeVPNServerAuthenticationByUsernamePrototype(method, identityProvider) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewVolumeIdentityByCRN successfully`, func() { crn := "crn:v1:bluemix:public:is:us-south-1:a/123456::volume:1a6b7274-678d-4dfb-8981-c71dd9d4daa5" _model, err := vpcService.NewVolumeIdentityByCRN(crn) @@ -80008,6 +83368,13 @@ var _ = Describe(`VpcV1`, func() { _, err := vpcService.NewVolumePrototypeVolumeByCapacity(profile, zone, capacity) Expect(err).ToNot(BeNil()) }) + It(`Invoke NewVolumePrototypeVolumeBySourceSnapshot successfully`, func() { + var profile vpcv1.VolumeProfileIdentityIntf = nil + var zone vpcv1.ZoneIdentityIntf = nil + var sourceSnapshot vpcv1.SnapshotIdentityIntf = nil + _, err := vpcService.NewVolumePrototypeVolumeBySourceSnapshot(profile, zone, sourceSnapshot) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewZoneIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/regions/us-south/zones/us-south-1" _model, err := vpcService.NewZoneIdentityByHref(href) @@ -80310,15 +83677,15 @@ var _ = Describe(`VpcV1`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref successfully`, func() { + It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref successfully`, func() { href := "https://us-south.iaas.cloud.ibm.com/v1/vpn_gateways/ddf51bec-3424-11e8-b467-0ed5f89f718b/connections/93487806-7743-4c46-81d6-72869883ea0b" - _model, err := vpcService.NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href) + _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID successfully`, func() { + It(`Invoke NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID successfully`, func() { id := "a10a5771-dc23-442c-8460-c3601d8542f7" - _model, err := vpcService.NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id) + _model, err := vpcService.NewRoutePrototypeNextHopRouteNextHopPrototypeVPNGatewayConnectionIdentityRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) })